Skip to main content

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


RecoveryAction

Enum-like type for recovery action suggestions.

Error Classes

InsufficientBalanceError

User does not have enough tokens for the transaction.
Recovery Action: 'add_funds'

NoRouteFoundError

No bridge route available for the requested path.
Recovery Action: 'try_different_amount'

SlippageExceededError

Price moved beyond the specified slippage tolerance.
Recovery Action: 'increase_slippage'

InvalidSlippageError

Slippage value is outside the valid range (0.01% - 5.0%).
Recovery Action: 'adjust_slippage'

TransactionFailedError

On-chain transaction reverted.
Recovery Action: 'retry'

UserRejectedError

User rejected the wallet prompt or transaction.
Recovery Action: 'try_again'

NetworkError

RPC or API communication failed.
Recovery Action: 'retry'

DepositFailedError

Hyperliquid L1 deposit step failed.
Recovery Action: 'retry'

ChainFetchError

Failed to fetch chain data from API.

MaxRetriesExceededError

Maximum retry attempts have been exhausted.
Recovery Action: 'contact_support'

QuoteExpiredError

The quote has expired and is no longer valid.
Recovery Action: '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.
Recovery Action: 'retry'

MinimumDepositError

Deposit amount is below the minimum (5 USDC).
Recovery Action: 'try_different_amount'

InsufficientGasError

Not enough native token for gas fees.
Recovery Action: 'add_funds'

DepositTransactionError

Deposit transaction failed on-chain.
Recovery Action: 'retry'

L1MonitorCancelledError

L1 deposit monitoring was cancelled.

InvalidL1AddressError

Invalid L1 address for deposit.

Type Guards

Type guard functions for checking error types.

Usage Examples

Basic Error Handling

Specific Error Handling

Checking Recoverability

Error Normalization

The SDK provides a helper to normalize any error to a MinaError: