Trait ethers_contract::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() -> Selector { ... }
}
Expand description
A helper trait for types that represents a custom error type
Required Methods§
sourcefn error_name() -> Cow<'static, str>
fn error_name() -> Cow<'static, str>
The name of the error
sourcefn abi_signature() -> Cow<'static, str>
fn abi_signature() -> Cow<'static, str>
Retrieves the ABI signature for the error
Provided Methods§
sourcefn from_rpc_response(response: &JsonRpcError) -> Option<Self>
Available on crate feature providers
only.
fn from_rpc_response(response: &JsonRpcError) -> Option<Self>
providers
only.Attempt to decode from a JsonRpcError
by extracting revert data
Fails if the error is not a revert, or decoding fails
sourcefn decode_with_selector(data: &[u8]) -> Option<Self>
fn decode_with_selector(data: &[u8]) -> Option<Self>
Decode the error from EVM revert data including an Error selector
Object Safety§
This trait is not object safe.