Error hierarchy
Everything the SDK throws extendsCestoError. Server responses become typed APIError
subclasses; transport problems become connection errors. All classes are exposed on the
Cesto client for instanceof checks.
| Class | When |
|---|---|
BadRequestError | 400 |
AuthenticationError | 401 — invalid / missing / revoked key |
PermissionDeniedError | 403 |
NotFoundError | 404 |
ConflictError | 409 |
UnprocessableEntityError | 422 |
RateLimitError | 429 — carries retryAfter (ms) |
InternalServerError | 5xx |
APIConnectionError | network failure |
APIConnectionTimeoutError | request exceeded timeout |
APIUserAbortError | your AbortSignal fired |
APIError carries status, code, requestId, and details from the API — useful
when reporting an issue.
Automatic retries
Transient failures (408, 409, 429, 5xx, connection errors, and timeouts) are retried automatically with exponential backoff and jitter, honoring theRetry-After header. Tune with maxRetries
(default 2), or disable per request with { maxRetries: 0 }.
Timeouts & cancellation
Each request times out aftertimeout ms (default 60s), throwing APIConnectionTimeoutError.
Pass an AbortSignal to cancel a request yourself: