Show / Hide Table of Contents

Class ApiException<T>

Contains HTTP client error details that result from a call to a Web API.

Inheritance
System.Object
ApiException<T>
ForbiddenException
PaymentRequiredException
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

The type of exception.

Constructors

View Source

ApiException()

Initializes a new instance of the ApiException<T> class.

Declaration
protected ApiException()
View Source

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.

View Source

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.

View Source

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 Source

DefaultApiErrorMessage

Gets the default API error message.

Declaration
protected virtual string DefaultApiErrorMessage { get; }
Property Value
Type Description
System.String
View Source

ErrorInfo

Gets the error information.

Declaration
public T ErrorInfo { get; }
Property Value
Type Description
T

The error information.

View Source

HttpErrorCode

Gets the HTTP error code.

Declaration
public int HttpErrorCode { get; }
Property Value
Type Description
System.Int32

The HTTP status code.

View Source

Message

Gets a message that describes the current exception.

Declaration
public override string Message { get; }
Property Value
Type Description
System.String

Methods

View Source

GetApiErrorInfo(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

An ApiException<T> instance.

See Also

System.Exception
  • View Source
In This Article
Back to top Copyright © DNV AS. All rights reserved.