Class ApiException<T>
Contains HTTP client error details that result from a call to a Web API.
Namespace: DNVGL.One.Compute.Platform.Client.Exceptions
Assembly: DNVGL.One.Compute.Platform.Client.dll
Syntax
public abstract class ApiException<T> : Exception where T : ApiErrorInfo
Type Parameters
Name | Description |
---|---|
T |
Constructors
View SourceApiException()
Initializes a new instance of the ApiException<T> class.
Declaration
protected ApiException()
ApiException(T, HttpStatusCode, Exception)
Initializes a new instance of the ApiException<T> class with a specified error message, System.Net.HttpStatusCode error code, and a reference to the inner exception that is the cause of this exception.
Declaration
protected ApiException(T apiError, HttpStatusCode httpStatusCode, Exception innerException)
Parameters
Type | Name | Description |
---|---|---|
T | apiError | The API error. |
HttpStatusCode | httpStatusCode | The HTTP status code from the response. |
Exception | innerException | The exception that is the cause of the current exception. If the innerException parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception. |
ApiException(String)
Initializes a new instance of the ApiException<T> class with a specified message.
Declaration
protected ApiException(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message, which is the JSON representation of an HTTP client error, describes the reason an exception. |
ApiException(String, Exception)
Initializes a new instance of the ApiException<T> class with a specified message and a reference to the inner exception that is the cause of this exception.
Declaration
protected ApiException(string message, Exception innerException)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message, which is the JSON representation of an HTTP client error, describes the reason for an exception. |
Exception | innerException | The exception that is the cause of the current exception. If the innerException parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception. |
Properties
View SourceDefaultApiErrorMessage
Gets the default api error message
Declaration
protected virtual string DefaultApiErrorMessage { get; }
Property Value
Type | Description |
---|---|
System.String |
ErrorInfo
Gets the error information.
Declaration
public T ErrorInfo { get; }
Property Value
Type | Description |
---|---|
T | The error information. |
HttpErrorCode
Gets the HTTP error code.
Declaration
public int HttpErrorCode { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The HTTP status code. |
Message
Gets a message that describes the current exception.
Declaration
public override string Message { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
View SourceGetApiErrorInfo(String)
Gets the API error from the message.
Declaration
public static T GetApiErrorInfo(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message in JSON format. |
Returns
Type | Description |
---|---|
T |