tgstation-server  4.3.2
The /tg/station 13 server suite
ErrorMessage.cs
Go to the documentation of this file.
1 using System;
2 using System.ComponentModel.DataAnnotations;
3 
4 namespace Tgstation.Server.Api.Models
5 {
9  public sealed class ErrorMessage
10  {
14  [Required]
15  public Version? ServerApiVersion { get; set; }
16 
20  [Required]
21  public string? Message { get; set; }
22 
26  public string? AdditionalData { get; set; }
27 
31  [EnumDataType(typeof(ErrorCode))]
32  public ErrorCode ErrorCode { get; set; }
33 
37  public ErrorMessage() { }
38 
43  public ErrorMessage(ErrorCode errorCode)
44  {
45  ErrorCode = errorCode;
46  Message = errorCode.Describe();
47  ServerApiVersion = ApiHeaders.Version;
48  }
49  }
50 }
ErrorCode
Types of ErrorMessages that the API may return.
Definition: ErrorCode.cs:10
ErrorMessage()
Initializes a new instance of the ErrorMessage .
Definition: ErrorMessage.cs:37
Represents the header that must be present for every server request
Definition: ApiHeaders.cs:17
static readonly Version Version
Get the version of the Api the caller is using
Definition: ApiHeaders.cs:62
ErrorMessage(ErrorCode errorCode)
Initializes a new instance of the ErrorMessage .
Definition: ErrorMessage.cs:43
Represents an error message returned by the server
Definition: ErrorMessage.cs:9