Skip to content

Exceptions

Exceptions

NotConnectedError

Bases: RuntimeError

Raised when the client hasn't connected (call connect()).

ApiException

Bases: Exception

Raised when an API request fails or returns an error response.

EthereumJSONRPCException

Bases: ApiException

Raised when an Ethereum JSON-RPC error payload is returned.

Source code in derive_client/exceptions.py
22
23
24
25
def __init__(self, code: int, message: str, data: Any = None):
    super().__init__(message)
    self.code = code
    self.data = data

DeriveJSONRPCException

Bases: ApiException

Raised when a Derive JSON-RPC error payload is returned.

Source code in derive_client/exceptions.py
35
36
37
38
def __init__(self, code: int, message: str, data: Any = None):
    super().__init__(message)
    self.code = code
    self.data = data

BridgeEventParseError

Bases: Exception

Raised when an expected cross-chain bridge event could not be parsed.

BridgeRouteError

Bases: Exception

Raised when no bridge route exists for the given currency and chains.

NoAvailableRPC

Bases: Exception

Raised when all configured RPC endpoints are temporarily unavailable due to backoff or failures.

InsufficientNativeBalance

Bases: Exception

Raised when the native currency balance is insufficient for gas and/or value transfer.

Source code in derive_client/exceptions.py
60
61
62
63
64
65
66
67
68
69
70
71
72
73
def __init__(
    self,
    message: str,
    *,
    chain_id: ChainID,
    balance: int,
    assumed_gas_limit: int,
    fee_estimate: FeeEstimate,
):
    super().__init__(message)
    self.chain_id = chain_id
    self.balance = balance
    self.assumed_gas_limit = assumed_gas_limit
    self.fee_estimate = fee_estimate

InsufficientTokenBalance

Bases: Exception

Raised when the token balance is insufficient for the requested operation.

BridgePrimarySignerRequiredError

Bases: Exception

Raised when bridging is attempted with a secondary session-key signer.

TxReceiptMissing

Bases: Exception

Raised when a transaction receipt is required but not available.

FinalityTimeout

Bases: Exception

Raised when the transaction was mined but did not reach the required finality within the timeout.

TxPendingTimeout

Bases: Exception

Raised when the transaction receipt does not materialize and the transaction remains in the mempool.

TransactionDropped

Bases: Exception

Raised when the transaction the transaction is no longer in the mempool, likely dropped.

BridgeEventTimeout

Bases: Exception

Raised when no matching bridge event was seen before deadline.

PartialBridgeResult

Bases: Exception

Raised after submission when the bridge pipeline fails

Source code in derive_client/exceptions.py
107
108
109
def __init__(self, message: str, *, tx_result: BridgeTxResult):
    super().__init__(message)
    self.tx_result = tx_result

StandardBridgeRelayFailed

Bases: Exception

Raised when the L2 messenger emits FailedRelayedMessage.

Source code in derive_client/exceptions.py
120
121
122
def __init__(self, message: str, *, event_log: TypedLogReceipt):
    super().__init__(message)
    self.event_log = event_log