Class ApiException
An unsuccessful HTTP response from the API. Mirrors JS APIError.
public class ApiException : TypeSafeException, ISerializable
- Inheritance
-
ApiException
- Implements
- Derived
- Inherited Members
Constructors
ApiException(HttpStatusCode, object?, HttpResponseHeaders, string?)
Create an API error from a completed HTTP response.
public ApiException(HttpStatusCode statusCode, object? body, HttpResponseHeaders headers, string? message = null)
Parameters
statusCodeHttpStatusCodebodyobjectheadersHttpResponseHeadersmessagestring
Properties
Body
Parsed JSON, response text, or null for an empty body.
public object? Body { get; }
Property Value
Headers
HTTP response headers.
public HttpResponseHeaders Headers { get; }
Property Value
RequestId
Request ID from x-typesafe-request-id, or null when absent.
public string? RequestId { get; }
Property Value
Status
Numeric HTTP status.
public int Status { get; }
Property Value
StatusCode
HTTP response status code.
public HttpStatusCode StatusCode { get; }
Property Value
Methods
FromResponse(HttpStatusCode, object?, HttpResponseHeaders)
Create the error subclass for an HTTP status code.
public static ApiException FromResponse(HttpStatusCode statusCode, object? body, HttpResponseHeaders headers)
Parameters
statusCodeHttpStatusCodebodyobjectheadersHttpResponseHeaders