Trait EthError

Source
pub trait EthError:
    Tokenizable
    + AbiDecode
    + AbiEncode
    + Send
    + Sync {
    // Required methods
    fn error_name() -> Cow<'static, str>;
    fn abi_signature() -> Cow<'static, str>;

    // Provided methods
    fn from_rpc_response(response: &JsonRpcError) -> Option<Self> { ... }
    fn decode_with_selector(data: &[u8]) -> Option<Self> { ... }
    fn selector() -> [u8; 4] { ... }
}
Expand description

A helper trait for types that represents a custom error type

Required Methods§

Source

fn error_name() -> Cow<'static, str>

The name of the error

Source

fn abi_signature() -> Cow<'static, str>

Retrieves the ABI signature for the error

Provided Methods§

Source

fn from_rpc_response(response: &JsonRpcError) -> Option<Self>

Attempt to decode from a JsonRpcError by extracting revert data

Fails if the error is not a revert, or decoding fails

Source

fn decode_with_selector(data: &[u8]) -> Option<Self>

Decode the error from EVM revert data including an Error selector

Source

fn selector() -> [u8; 4]

The selector of the 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§

Source§

impl EthError for String

Implementors§