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() -> Selector { ... }
}
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>

Available on crate feature providers only.

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() -> Selector

The selector of the error

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl EthError for String

Implementors§