Class: APIError#

Defined in: sdk-js/src/v4/internal/errors.ts:9

Thrown when the server returns a 4xx/5xx response. The aggregator speaks RFC 7807 problem+json (application/problem+json); this class surfaces every field plus the underlying HTTP status so SDK callers can pattern-match without re-parsing the body.

Extends#

  • Error

Constructors#

Constructor#

new APIError(status: number, init: object): APIError;

Defined in: sdk-js/src/v4/internal/errors.ts:21

Parameters#

ParameterTypeDescription
statusnumber-
init{ code?: string; title?: string; detail?: string; requestId?: string; problem?: { type: string; title: string; status: number; detail?: string; instance?: string; code?: string; }; }-
init.code?string-
init.title?string-
init.detail?string-
init.requestId?string-
init.problem?{ type: string; title: string; status: number; detail?: string; instance?: string; code?: string; }-
init.problem.typestringFormat: uri Description URI identifying the problem type. Example https://docs.avaprotocol.org/errors/workflow-not-found
init.problem.titlestringDescription Short, human-readable summary. Example Workflow not found
init.problem.statusnumberFormat: int32 Description HTTP status code (echoed for clients that surface only the body). Example 404
init.problem.detail?stringDescription Human-readable explanation specific to this occurrence. Example No workflow with id 01JG2FE5MDVKBPHEG0PEYSDKAC for owner 0xabc...
init.problem.instance?stringDescription URI / opaque ID identifying this specific occurrence (e.g., request id). Example req_01JG2FE5MFKTH0754RGF2DMVY7
init.problem.code?stringDescription Machine-readable error code. Stable across releases; clients can switch on this for programmatic handling. Mirrors the gRPC-era ErrorCode enum vocabulary. Example WORKFLOW_NOT_FOUND

Returns#

APIError

Overrides#

Error.constructor

Properties#

PropertyModifierTypeDescriptionDefined in
statusreadonlynumberHTTP status code (echoed from the response).sdk-js/src/v4/internal/errors.ts:11
code?readonlystringMachine-readable error code (Problem.code), e.g. AUTH_INVALID_TOKEN.sdk-js/src/v4/internal/errors.ts:13
title?readonlystringShort human-readable summary (Problem.title).sdk-js/src/v4/internal/errors.ts:15
requestId?readonlystringPer-request identifier — also surfaced via X-Request-ID header.sdk-js/src/v4/internal/errors.ts:17
problem?readonlyobjectThe full parsed Problem body, when the server returned one.sdk-js/src/v4/internal/errors.ts:19
problem.typereadonlystringFormat: uri Description URI identifying the problem type. Example https://docs.avaprotocol.org/errors/workflow-not-foundtypes/dist/openapi.gen.d.ts:660
problem.titlereadonlystringDescription Short, human-readable summary. Example Workflow not foundtypes/dist/openapi.gen.d.ts:665
problem.statusreadonlynumberFormat: int32 Description HTTP status code (echoed for clients that surface only the body). Example 404types/dist/openapi.gen.d.ts:671
problem.detail?readonlystringDescription Human-readable explanation specific to this occurrence. Example No workflow with id 01JG2FE5MDVKBPHEG0PEYSDKAC for owner 0xabc...types/dist/openapi.gen.d.ts:676
problem.instance?readonlystringDescription URI / opaque ID identifying this specific occurrence (e.g., request id). Example req_01JG2FE5MFKTH0754RGF2DMVY7types/dist/openapi.gen.d.ts:681
problem.code?readonlystringDescription Machine-readable error code. Stable across releases; clients can switch on this for programmatic handling. Mirrors the gRPC-era ErrorCode enum vocabulary. Example WORKFLOW_NOT_FOUNDtypes/dist/openapi.gen.d.ts:688