APIError instances with structured metadata for error handling.
Import
APIError Class
Usage
Error Codes
Initialization Errors
| Code | Description | Resolution |
|---|---|---|
SDK_NOT_INITIALIZED | SDK function called before initAmplifySDK() | Call initAmplifySDK() at app startup |
INVALID_API_KEY | API key validation failed | Check key format (pxl_...) |
Deposit Errors
| Code | Description | Resolution |
|---|---|---|
VAULT_NOT_FOUND | No vault matches yieldType, token, and chainId | Verify parameters with fetchSupportedAssets() |
PERMIT_NOT_SUPPORTED | Token doesn’t support EIP-2612 permits | Use approval flow or forceMethod: "approval" |
INSUFFICIENT_ALLOWANCE | Approval amount insufficient for deposit | Increase approval or use permit flow |
INVALID_DEPOSIT_AMOUNT | Amount is zero, negative, or malformed | Provide valid decimal string (e.g., “100.25”) |
Withdrawal Errors
| Code | Description | Resolution |
|---|---|---|
VAULT_NOT_FOUND | No vault matches parameters | Verify yieldType and wantAssetAddress |
INSUFFICIENT_SHARES | User doesn’t have enough vault shares | Check share balance before withdrawing |
LIQUIDITY_UNAVAILABLE | Vault has insufficient liquidity | Try smaller amount or wait |
Network Errors
| Code | Description | Resolution |
|---|---|---|
NETWORK_ERROR | Failed to connect to RPC or API | Check network connection and RPC URL |
TIMEOUT | Request timed out | Retry with backoff |
Error Handling Patterns
Basic Error Handling
Logging Errors
User-Friendly Messages
Related
- Troubleshooting - Common issues and solutions
- Logging Guide - Debug logging configuration