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 error category, so you can branch on an enum instead of parsing strings. Route errors use INVALID_REQUEST, NOT_FOUND, INSUFFICIENT_BALANCE, IDEMPOTENCY_CONFLICT, ORDER_NOT_CANCELLABLE, ORDER_RECONCILIATION_REQUIRED and INTERNAL_ERROR; signed-auth rejections use UNAUTHORIZED, FORBIDDEN, AUTH_UNAVAILABLE and BAD_CONTENT_HASH. It is undefined for a response that carries no error envelope.
  • status: the HTTP status code.
  • message: a human-readable explanation.
Authentication failures arrive in the same envelope as route errors, so code is populated: a rejected signature is a 401 with UNAUTHORIZED, and a key without the capability for a route is a 403 with FORBIDDEN.