tgstation-server
The /tg/station 13 server suite
ClientException.cs
Go to the documentation of this file.
1 using System;
2 using System.Net;
4 
6 {
10  public abstract class ClientException : Exception
11  {
15  public HttpStatusCode StatusCode { get; }
16 
20  public Version ServerApiVersion { get; }
21 
27  protected ClientException(ErrorMessage errorMessage, HttpStatusCode statusCode) : base(errorMessage == null ? throw new ArgumentNullException(nameof(errorMessage)) : errorMessage.Message ?? "Unknown Error")
28  {
29  StatusCode = statusCode;
30  ServerApiVersion = errorMessage?.SeverApiVersion;
31  }
32 
36  protected ClientException() { }
37 
42  protected ClientException(string message) : base(message) { }
43 
49  protected ClientException(string message, Exception innerException) : base(message, innerException) { }
50  }
51 }
ClientException()
Construct a ClientException
ClientException(string message, Exception innerException)
Construct a ClientException with a message and innerException
HttpStatusCode StatusCode
The HttpStatusCode of the ClientException
ClientException(string message)
Construct a ClientException with a message
Version ServerApiVersion
The Version of the server's API
Version SeverApiVersion
The version of the API the server is using
Definition: ErrorMessage.cs:18
Represents an error message returned by the server
Definition: ErrorMessage.cs:8
Exceptions thrown by IServerClients