Skip to main content

RubicApiError

All API-level errors thrown by the default HTTP client are wrapped into RubicApiError, a typed subclass of Error. You can find more information about error handling here

Fields


Catching errors


Common error codes

These codes are illustrative. Always check err.reason for the exact message from the API.

Error patterns by method

Quote expired — re-quote

Quote IDs expire after a short period. If you get an expiry error on swap, re-run the quote:

Minimum amount

Network / timeout errors


Polling timeout

waitForStatus rejects with a plain Error('Polling timeout') (not a RubicApiError) when the total timeout is exceeded:

Custom HTTP client — error forwarding

If you use a custom HTTP client, you are responsible for parsing API errors. Use RubicApiError.fromApiResponse to convert the raw response body: