Table of Contents

Class ApiException

Namespace
TypeSafe.AI.Sdk
Assembly
TypeSafe.AI.Sdk.dll

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

statusCode HttpStatusCode
body object
headers HttpResponseHeaders
message string

Properties

Body

Parsed JSON, response text, or null for an empty body.

public object? Body { get; }

Property Value

object

Headers

HTTP response headers.

public HttpResponseHeaders Headers { get; }

Property Value

HttpResponseHeaders

RequestId

Request ID from x-typesafe-request-id, or null when absent.

public string? RequestId { get; }

Property Value

string

Status

Numeric HTTP status.

public int Status { get; }

Property Value

int

StatusCode

HTTP response status code.

public HttpStatusCode StatusCode { get; }

Property Value

HttpStatusCode

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

statusCode HttpStatusCode
body object
headers HttpResponseHeaders

Returns

ApiException