PraxaClient throws a PraxaClientError for every HTTP error response it receives from the gateway. This is the only error type the SDK itself raises for API failures — all other thrown values (such as TypeError for network connectivity issues or DOMException for aborted requests) originate from the underlying fetch implementation. Because PraxaClientError extends the native Error class, you can use a standard instanceof check in any catch block to distinguish API errors from unexpected exceptions.
PraxaClientError
PraxaClientError carries two pieces of structured information alongside the inherited message string:
The
Problem type looks like this:
instanceof PraxaClientError to safely narrow the type and access status and problem:
Common Error Status Codes
Automatic Retries
The SDK silently retries requests that return a retryable status code, as long as the request is safe to replay. The retryable status codes are: 408, 425, 429, 500, 502, 503, and 504. A request is eligible for retry when it either:- Carries an idempotency key (e.g.
createMission,signalMission,cancelMission), or - Is a safe read (all
GETrequests andsearchCapabilities/queryMemory).
maximumAttempts total attempts (default 3, maximum 4) with exponential backoff: before attempt n it waits retryBaseDelayMs × 2^(n-1) milliseconds. The idempotency key is preserved unchanged on every retry so the gateway can detect and discard duplicates.
PraxaClientError for your code to handle.
Non-Retryable Errors
The following status codes indicate a client-side problem that retrying will not fix. The SDK throws immediately without any retry:- 400 Bad Request — the request payload is structurally invalid.
- 401 Unauthorized — the access token is missing or expired.
- 403 Forbidden — the token lacks the required OAuth scope.
- 404 Not Found — the requested resource does not exist.
- 409 Conflict — an idempotency key conflict was detected.
401 specifically, refresh the token and resubmit. For 400 and 409, inspect err.problem to understand exactly what went wrong before attempting again.