RubicApiError
All API-level errors thrown by the default HTTP client are wrapped intoRubicApiError, 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 onswap, 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. UseRubicApiError.fromApiResponse to convert the raw response body: