Skip to main content
Resource methods throw a RequestError for any non-2xx response, so you handle failures with try/catch rather than inspecting each result. On success, a method resolves with its typed payload. RequestError exposes:
  • code — a stable ApiErrorCode (e.g. INVALID_REQUEST, INSUFFICIENT_BALANCE, NOT_FOUND), so you can branch on an enum instead of parsing strings. It is undefined for errors raised before a handler runs.
  • status — the HTTP status code.
  • message — a human-readable explanation.
Authentication failures are returned by the gateway before a handler runs: they surface as a RequestError with status 403 and no code — check status in that case.