tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
ApiException.cs
Go to the documentation of this file.
1using System;
2using System.Net.Http;
3
6
8{
12 public abstract class ApiException : ClientException
13 {
17 public Version? ServerApiVersion { get; }
18
22 public string? AdditionalServerData { get; }
23
27 public ErrorCode? ErrorCode { get; }
28
34 protected ApiException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage)
35 : base(
36 responseMessage,
37 errorMessage?.Message ?? $"HTTP {responseMessage?.StatusCode ?? throw new ArgumentNullException(nameof(responseMessage))}. Unknown API error, ErrorMessage payload not present!")
38 {
39 ServerApiVersion = errorMessage?.ServerApiVersion;
41 ErrorCode = errorMessage?.ErrorCode;
42 }
43
49 protected ApiException(HttpResponseMessage responseMessage, string message)
50 : base(responseMessage, message)
51 {
52 }
53
57 protected ApiException()
58 {
59 }
60
65 protected ApiException(string message)
66 : base(message)
67 {
68 }
69
75 protected ApiException(string message, Exception innerException)
76 : base(message, innerException)
77 {
78 }
79 }
80}
Represents an error message returned by the server.
Version? ServerApiVersion
The version of the API the server is using.
string? AdditionalData
Additional data associated with the error message.
ErrorCode ErrorCode
The ErrorCode of the ErrorMessageResponse.
string? AdditionalServerData
Additional error data from the server.
ApiException(HttpResponseMessage responseMessage, string message)
Initializes a new instance of the ApiException class.
Version? ServerApiVersion
The Version of the server's API.
ApiException(string message, Exception innerException)
Initializes a new instance of the ApiException class.
ApiException()
Initializes a new instance of the ApiException class.
ApiException(ErrorMessageResponse? errorMessage, HttpResponseMessage responseMessage)
Initializes a new instance of the ApiException class.
ApiException(string message)
Initializes a new instance of the ApiException class.
Exceptions thrown by IRestServerClients.
ErrorCode
Types of Response.ErrorMessageResponses that the API may return.
Definition ErrorCode.cs:12