Skip to main content
This page is the how-to complement to the Errors overview. It shows the branching pattern in concrete code and the retry rules per error class.

The branching pattern

The canonical branching pattern in pseudocode:
Two rules of thumb:
  1. Never branch on error.message — it is unstable.
  2. Always inspect error.details[] before treating an error as terminal — the specific reason often dictates a different recovery path.

Concrete examples

Retry semantics by status

Apply this table without modification — it is the standard. Detailed retry mechanics in Retry strategy.

Idempotency on retry

When you do retry — RESOURCE_EXHAUSTED, provider/database/upstream UNAVAILABLE, or the one-shot retry after REPLAY_DETECTED — keep these stable across attempts: The signer should be designed so that only the body bytes feed into the canonical request as content; everything else is fresh per attempt.

Logging recommendations

For every non-2xx response, log at minimum:
  • HTTP method and URL (without secret query-string values).
  • error.status and error.code.
  • Every details[].reason.
  • metadata.decisionId if present.
  • metadata.id from ERROR_RECORDED if present.
  • The full details[] array as structured JSON (designed to be safe to log).
  • Approximate UTC time of the request.
  • Your X-Access-Request-Id (your correlation handle).
Do not log: credentials, the private key, raw signatures, full request bodies containing PII.

Next

Retry strategy

The exact backoff formula and limits.

Error catalog

Every reason code with HTTP status and remediation.