Show / Hide Table of Contents

Class ApiException<T>

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

Inheritance
object
Exception
ApiException<T>
ForbiddenException
PaymentRequiredException
Implements
ISerializable
Inherited Members
Exception.GetBaseException()
Exception.GetObjectData(SerializationInfo, StreamingContext)
Exception.GetType()
Exception.ToString()
Exception.Data
Exception.HelpLink
Exception.HResult
Exception.InnerException
Exception.Source
Exception.StackTrace
Exception.TargetSite
Exception.SerializeObjectState
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: DNVGL.One.Compute.Platform.Client.Exceptions
Assembly: DNVGL.One.Compute.Platform.Client.dll
Syntax
public abstract class ApiException<T> : Exception, ISerializable 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()
See Also
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 = null)
Parameters
Type Name Description
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.

See Also
Exception
View Source

ApiException(T, HttpStatusCode, Exception)

Initializes a new instance of the ApiException<T> class with a specified error message, 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.

See Also
Exception

Properties

View Source

DefaultApiErrorMessage

Gets the default API error message.

Declaration
protected virtual string DefaultApiErrorMessage { get; }
Property Value
Type Description
string
See Also
Exception
View Source

ErrorInfo

Gets the error information.

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

The error information.

See Also
Exception
View Source

HttpErrorCode

Gets the HTTP error code.

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

The HTTP status code.

See Also
Exception
View Source

Message

Gets a message that describes the current exception.

Declaration
public override string Message { get; }
Property Value
Type Description
string
Overrides
Exception.Message
See Also
Exception

Methods

View Source

GetApiErrorInfo(string)

Gets the API error from the message.

Declaration
public static T GetApiErrorInfo(string message)
Parameters
Type Name Description
string message

The message in JSON format.

Returns
Type Description
T

An ApiException<T> instance.

See Also
Exception

Implements

ISerializable

See Also

Exception
  • View Source
In this article
Back to top Copyright © DNV AS. All rights reserved.