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§
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>
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
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
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.