Skip to content

isRetryable

isRetryable(error): boolean

Return whether an error kind is generally safe to retry.

Returns true for these ErrorKind values:

  • NETWORK — transport-level failure during a request (DNS, refused, timeout, mid-flight fetch error). Safe to retry GETs and other read surfaces; for side-effectful POSTs the request may already have landed on the server, so retry only when the surface is idempotent or use an idempotency key / state reconciliation before replaying.
  • CANCELLED — the caller aborted; retry only if the caller still wants the result.
  • BACKEND — generic server-side failure with no specific domain code; retry with backoff and surface the message if it persists.
  • RATE_LIMITED — caller exceeded the budget; retry after the WarmHubError.retryAfter interval.

All other kinds — including backend pass-through domain codes such as SHAPE_MISMATCH or WREF_UNRESOLVABLE — return false. This is a conservative default: for most pass-through codes the caller must fix the input or escalate, but the backend reuses some codes for transient conditions (notably INTERNAL_ERROR from the webhook-validation path, whose message literally says please retry). See the pass-through paragraph on ErrorKind — read WarmHubError.message before giving up on a false return from this helper.

unknown

boolean