SpekoApiError
Base class for all API errors. Carries HTTP status plus a server-provided code.
code is parsed from the JSON body ({ "error": "...", "code": "..." }); falls back to "UNKNOWN" when the body isn’t JSON.
SpekoAuthError
Thrown on HTTP 401. Extends SpekoApiError with status: 401, code: 'AUTH_ERROR'.
SpekoRateLimitError
Thrown on HTTP 429. Extends SpekoApiError with code: 'RATE_LIMITED' and a parsed retryAfter (seconds) from the Retry-After response header.
Timeouts and cancellation
When the internal timeout fires or an externalAbortSignal is aborted, fetch rejects with a DOMException named AbortError. The SDK does not re-wrap these — callers can distinguish abort from API failure with a standard instanceof / .name === 'AbortError' check.