ApiException
Namespace: TypeSafe.AI.Sdk
public class ApiException : TypeSafeException, ISerializableAn unsuccessful HTTP response from the API. Mirrors JS APIError.
Inheritance: object → Exception → TypeSafeException
Implements: ISerializable
Derived: AuthenticationException, BadRequestException, InternalServerException, NotFoundException, PermissionDeniedException, RateLimitException, UnprocessableEntityException
Constructors
Section titled “Constructors”ApiException(HttpStatusCode, object?, HttpResponseHeaders, string?)
Section titled “ApiException(HttpStatusCode, object?, HttpResponseHeaders, string?)”public ApiException(HttpStatusCode statusCode, object? body, HttpResponseHeaders headers, string? message = null)Create an API error from a completed HTTP response.
Parameters
| Name | Type | Description |
|---|---|---|
statusCode |
HttpStatusCode | |
body |
object | |
headers |
HttpResponseHeaders | |
message |
string |
Properties
Section titled “Properties”public object? Body { get; }Parsed JSON, response text, or null for an empty body.
Value: object
Headers
Section titled “Headers”public HttpResponseHeaders Headers { get; }HTTP response headers.
Value: HttpResponseHeaders
RequestId
Section titled “RequestId”public string? RequestId { get; }Request ID from x-typesafe-request-id, or null when absent.
Value: string
Status
Section titled “Status”public int Status { get; }Numeric HTTP status.
Value: int
StatusCode
Section titled “StatusCode”public HttpStatusCode StatusCode { get; }HTTP response status code.
Value: HttpStatusCode
Methods
Section titled “Methods”FromResponse(HttpStatusCode, object?, HttpResponseHeaders)
Section titled “FromResponse(HttpStatusCode, object?, HttpResponseHeaders)”public static ApiException FromResponse(HttpStatusCode statusCode, object? body, HttpResponseHeaders headers)Create the error subclass for an HTTP status code.
Parameters
| Name | Type | Description |
|---|---|---|
statusCode |
HttpStatusCode | |
body |
object | |
headers |
HttpResponseHeaders |
Returns: ApiException
MIT · Copyright (c) Dario Kondratiuk. · not affiliated with TypeSafe beyond being a client of the public API