NexusError class. All errors include a specific error code, message, and optional contextual data.
Error Structure
Error Handling Example
Error Categories
User Actions
Errors triggered by user decisions or cancellations.USER_DENIED_INTENT
USER_DENIED_INTENT
deny() is called in setOnIntentHook()User action: None - user intentionally cancelled the operationExample:USER_DENIED_ALLOWANCE
USER_DENIED_ALLOWANCE
deny() is called in setOnAllowanceHook()User action: None - user intentionally cancelledExample:USER_DENIED_INTENT_SIGNATURE
USER_DENIED_INTENT_SIGNATURE
USER_DENIED_SIWE_SIGNATURE
USER_DENIED_SIWE_SIGNATURE
Balance & Funds
Errors related to insufficient balances or fund availability.INSUFFICIENT_BALANCE
INSUFFICIENT_BALANCE
- Check available balance with
getBalancesForBridge() - Deposit more funds
- Reduce the amount
NO_BALANCE_FOR_ADDRESS
NO_BALANCE_FOR_ADDRESS
Validation Errors
Errors from invalid input parameters or configuration.INVALID_INPUT
INVALID_INPUT
- Negative amounts
- Invalid chain IDs
- Malformed addresses
INVALID_ADDRESS_LENGTH
INVALID_ADDRESS_LENGTH
0x and be 42 characters)Example: 0x742d35Cc6634C0532925a3b8D4C9db96c4b4Db45 (correct)INVALID_VALUES_ALLOWANCE_HOOK
INVALID_VALUES_ALLOWANCE_HOOK
allow() in allowance hook.When it occurs: When allowance hook receives invalid approval amountsUser action: Use valid values: 'min', 'max', or a bigint amountExample:TOKEN_NOT_SUPPORTED
TOKEN_NOT_SUPPORTED
Initialization Errors
Errors related to SDK initialization and setup.SDK_NOT_INITIALIZED
SDK_NOT_INITIALIZED
initialize() completesUser action: Call initialize() before using SDK methodsExample:SDK_INIT_STATE_NOT_EXPECTED
SDK_INIT_STATE_NOT_EXPECTED
WALLET_NOT_CONNECTED
WALLET_NOT_CONNECTED
CONNECT_ACCOUNT_FAILED
CONNECT_ACCOUNT_FAILED
- Check wallet is unlocked
- Grant connection permission
- Retry connection
Chain & Network Errors
Errors related to blockchain networks and configuration.CHAIN_NOT_FOUND
CHAIN_NOT_FOUND
CHAIN_DATA_NOT_FOUND
CHAIN_DATA_NOT_FOUND
- Check internet connection
- Verify RPC endpoints are accessible
- Retry after a moment
VAULT_CONTRACT_NOT_FOUND
VAULT_CONTRACT_NOT_FOUND
ENVIRONMENT_NOT_SUPPORTED
ENVIRONMENT_NOT_SUPPORTED
'mainnet' or 'testnet' for network parameterENVIRONMENT_NOT_KNOWN
ENVIRONMENT_NOT_KNOWN
UNIVERSE_NOT_SUPPORTED
UNIVERSE_NOT_SUPPORTED
Transaction Errors
Errors during transaction execution.TRANSACTION_TIMEOUT
TRANSACTION_TIMEOUT
- Check transaction on block explorer
- Retry with higher gas price
- Wait for network congestion to clear
TRANSACTION_REVERTED
TRANSACTION_REVERTED
- Verify contract parameters
- Check token allowances
- Review transaction data
TRANSACTION_CHECK_ERROR
TRANSACTION_CHECK_ERROR
FETCH_GAS_PRICE_FAILED
FETCH_GAS_PRICE_FAILED
- Check network connection
- Retry operation
- Specify gas price manually if supported
Operation Errors
Errors during specific SDK operations.SIMULATION_FAILED
SIMULATION_FAILED
simulate*() methods encounter errorsUser action:- Verify parameters are correct
- Check sufficient balance including gas
- Review token approvals
QUOTE_FAILED
QUOTE_FAILED
- Retry request
- Check token pair is supported
- Verify amounts are within limits
SWAP_FAILED
SWAP_FAILED
- Check error details in
error.data - Verify token balances
- Retry operation
REFUND_FAILED
REFUND_FAILED
refundIntent() failsUser action: Contact support with intent ID and error detailsREFUND_CHECK_ERROR
REFUND_CHECK_ERROR
Intent & Solver Errors
Errors related to intent processing and solver network.LIQUIDITY_TIMEOUT
LIQUIDITY_TIMEOUT
- Retry after a few minutes
- Reduce transfer amount
- Try different source chains
RATES_CHANGED_BEYOND_TOLERANCE
RATES_CHANGED_BEYOND_TOLERANCE
- Refresh intent/quote
- Retry operation
- Accept new rates
RFF_FEE_EXPIRED
RFF_FEE_EXPIRED
DESTINATION_REQUEST_HASH_NOT_FOUND
DESTINATION_REQUEST_HASH_NOT_FOUND
DESTINATION_SWEEP_ERROR
DESTINATION_SWEEP_ERROR
Allowance Errors
Errors related to token approvals and allowances.SLIPPAGE_EXCEEDED_ALLOWANCE
SLIPPAGE_EXCEEDED_ALLOWANCE
- Increase allowance amount
- Approve with
'max'instead of'min' - Retry operation
ALLOWANCE_SETTING_ERROR
ALLOWANCE_SETTING_ERROR
- Retry approval
- Check gas balance
- Verify wallet connection
Other Errors
INTERNAL_ERROR
INTERNAL_ERROR
- Report to support with full error details
- Include
error.dataanderror.stack - Provide reproduction steps
UNKNOWN_SIGNATURE
UNKNOWN_SIGNATURE
ASSET_NOT_FOUND
ASSET_NOT_FOUND
COSMOS_ERROR
COSMOS_ERROR
FEE_GRANT_REQUESTED
FEE_GRANT_REQUESTED
Complete Error Codes List
Best Practices
-
Always check error types:
-
Log error details for debugging:
-
Handle user cancellations gracefully:
-
Provide contextual recovery actions: