Skip to content

1681-engine / index / ApiError

Class: ApiError ​

Defined in: src/net/ApiClient.ts:10

A request that failed. status 0 with code 'NETWORK' is no answer at all (offline, a timeout, a refused connection), 'ABORTED' the caller's own abort; otherwise status is the server's, and code, message and details are what describe read off its body.

Extends ​

  • Error

Constructors ​

Constructor ​

ts
new ApiError(
   status, 
   code, 
   message, 
   details?, 
   body?
): ApiError;

Defined in: src/net/ApiClient.ts:11

Parameters ​

ParameterTypeDescription
statusnumber-
codestring-
messagestring-
details?Readonly<Record<string, string>>-
body?unknownThe parsed body of the failed answer, when there was one.

Returns ​

ApiError

Overrides ​

ts
Error.constructor

Properties ​

body? ​

ts
readonly optional body?: unknown;

Defined in: src/net/ApiClient.ts:17

The parsed body of the failed answer, when there was one.


code ​

ts
readonly code: string;

Defined in: src/net/ApiClient.ts:13


details? ​

ts
readonly optional details?: Readonly<Record<string, string>>;

Defined in: src/net/ApiClient.ts:15


status ​

ts
readonly status: number;

Defined in: src/net/ApiClient.ts:12

Released under the MIT License.