Trait EvmError

pub trait EvmError:
    Sized
    + Error
    + Send
    + Sync
    + 'static {
    type InvalidTransaction: InvalidTxError;

    // Required methods
    fn as_invalid_tx_err(&self) -> Option<&Self::InvalidTransaction>;
    fn try_into_invalid_tx_err(self) -> Result<Self::InvalidTransaction, Self>;

    // Provided method
    fn is_invalid_tx_err(&self) -> bool { ... }
}
Available on crate feature evm only.
Expand description

Abstraction over errors that can occur during EVM execution.

It’s assumed that errors can occur either because of an invalid transaction, meaning that other transaction might still result in successful execution, or because of a general EVM misconfiguration.

If caller occurs a error different from EvmError::InvalidTransaction, it should most likely be treated as fatal error flagging some EVM misconfiguration.

Required Associated Types§

type InvalidTransaction: InvalidTxError

Errors which might occur as a result of an invalid transaction. i.e unrelated to general EVM configuration.

Required Methods§

fn as_invalid_tx_err(&self) -> Option<&Self::InvalidTransaction>

Returns the EvmError::InvalidTransaction if the error is an invalid transaction error.

fn try_into_invalid_tx_err(self) -> Result<Self::InvalidTransaction, Self>

Attempts to convert the error into EvmError::InvalidTransaction.

Provided Methods§

fn is_invalid_tx_err(&self) -> bool

Returns true if the error is an invalid transaction error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl<DBError, TxError> EvmError for EVMError<DBError, TxError>
where DBError: Error + Send + Sync + 'static, TxError: InvalidTxError,

§

type InvalidTransaction = TxError

§

fn as_invalid_tx_err( &self, ) -> Option<&<EVMError<DBError, TxError> as EvmError>::InvalidTransaction>

§

fn try_into_invalid_tx_err( self, ) -> Result<<EVMError<DBError, TxError> as EvmError>::InvalidTransaction, EVMError<DBError, TxError>>

Implementors§