Error Handling
The SDK throws typed errors for different failure conditions. All errors extendArgyrosError.
Error Hierarchy
Error Classes
ArgyrosError
Base class for all SDK errors.
| Property | Type | Description |
|---|---|---|
message | string | Error message |
statusCode | number | HTTP status code |
body | unknown | Raw response body from the API |
BadRequestError (400)
Thrown for invalid parameters: bad mint address, invalid amount, unsupported swap mode.
AuthError (401/403)
Thrown when the API key is invalid, missing, or revoked.
NoRouteError (404)
Thrown when no liquidity path exists between the input and output tokens.
RateLimitError (429)
Thrown after all retry attempts are exhausted on rate-limited requests.
ServerError (5xx)
Thrown after all retry attempts are exhausted on server errors.
Retry Behavior
The SDK automatically retries on transient failures before throwing:| Status | Retried | Error thrown after exhaustion |
|---|---|---|
| 400 | no | BadRequestError (immediate) |
| 401/403 | no | AuthError (immediate) |
| 404 | no | NoRouteError (immediate) |
| 429 | yes | RateLimitError |
| 5xx | yes | ServerError |
| Network error / timeout | yes | Error |
retries: 2, the SDK makes up to 3 attempts.