Skip to content

WarmHubError

Normalized error shape thrown by the WarmHub SDK.

SDK helpers convert transport, tRPC, validation, and backend failures into this class so callers can branch on stable code / kind values and read optional response metadata such as status, hint, and retryAfter.

See ErrorKind for the catalog of stable kinds with cause, retryability, corrective action, and origin per kind, and isRetryable for the canonical retry test.

try {
await client.repo.get('acme', 'world')
} catch (err) {
if (isWarmHubError(err) && err.kind === 'NOT_FOUND') {
// handle missing repo
} else if (isRetryable(err)) {
// safe to retry (NETWORK, CANCELLED, BACKEND, RATE_LIMITED)
} else {
throw err
}
}
  • Error

new WarmHubError(code, message, status?, hint?, retryAfter?, backendCode?, details?): WarmHubError

string

string

number

string

number

string

WarmHubErrorDetails

WarmHubError

Error.constructor

readonly code: string

Stable SDK error code or pass-through backend domain code. Branch on this (or the alias kind) to handle expected failure modes.


readonly optional status?: number

HTTP status from the failing response when one was available.


readonly optional hint?: string

Optional human-readable hint surfaced by the backend.


readonly optional retryAfter?: number

Seconds the caller should wait before retrying. Present on RATE_LIMITED responses and other backend signals that carry a Retry-After header.


readonly optional backendCode?: string

Backend domain code from the response body. Set iff the backend wire carried a structured error.code string. Use this when the question is “did the backend specifically say this?”. For best-effort labelling that also covers SDK-local transport codes (NETWORK, CANCELLED, the generic BACKEND fallback), branch on code or kind.


readonly optional details?: WarmHubErrorDetails

Structured backend error details, when the response carried them. Branch on details.reason: an expected_version_mismatch carries expectedVersion/currentVersion so an optimistic-concurrency caller can re-read HEAD and retry (#3624); a lease_held carries leaseExpiresAt so a caller can back off until the lease expires (#3625). Present only when the backend wire carried data.warmhub.details. See WarmHubErrorDetails.

get kind(): ErrorKind

ErrorKind