Error Classes
The Mina SDK provides typed error classes with recovery guidance for handling failures gracefully.MinaError (Base Class)
Abstract base class for all SDK errors. Provides structured error information including recovery actions.Properties
| Property | Type | Description |
|---|---|---|
code | string | Unique error code (e.g., 'INSUFFICIENT_BALANCE') |
recoverable | boolean | true if the error can potentially be resolved by retrying |
step | StepType | Which step failed: 'approval', 'swap', 'bridge', or 'deposit' |
userMessage | string | Human-readable message safe to display to users |
recoveryAction | RecoveryAction | Suggested action to resolve the error |
details | Record<string, unknown> | Additional context for debugging |
RecoveryAction
Enum-like type for recovery action suggestions.| Action | Description |
|---|---|
'retry' | Retry the same operation |
'add_funds' | User needs to add more tokens |
'increase_slippage' | Increase slippage tolerance |
'try_different_amount' | Try a different bridge amount |
'try_again' | Start the flow over |
'fetch_new_quote' | Get a fresh quote |
'contact_support' | Escalate to support |
'switch_network' | Switch to the correct network |
'check_allowance' | Check token approval |
'adjust_slippage' | Adjust slippage to valid range |
Error Classes
InsufficientBalanceError
User does not have enough tokens for the transaction.'add_funds'
NoRouteFoundError
No bridge route available for the requested path.'try_different_amount'
SlippageExceededError
Price moved beyond the specified slippage tolerance.'increase_slippage'
InvalidSlippageError
Slippage value is outside the valid range (0.01% - 5.0%).'adjust_slippage'
TransactionFailedError
On-chain transaction reverted.'retry'
UserRejectedError
User rejected the wallet prompt or transaction.'try_again'
NetworkError
RPC or API communication failed.'retry'
DepositFailedError
Hyperliquid L1 deposit step failed.'retry'
ChainFetchError
Failed to fetch chain data from API.MaxRetriesExceededError
Maximum retry attempts have been exhausted.'contact_support'
QuoteExpiredError
The quote has expired and is no longer valid.'fetch_new_quote'
TokenFetchError
Failed to fetch token data from API.BalanceFetchError
Failed to fetch balance data from API.InvalidAddressError
Invalid Ethereum address format.QuoteFetchError
Failed to fetch quote from API.'retry'
MinimumDepositError
Deposit amount is below the minimum (5 USDC).'try_different_amount'
InsufficientGasError
Not enough native token for gas fees.'add_funds'
DepositTransactionError
Deposit transaction failed on-chain.'retry'
