pub trait ErrorDecoder: Send + Sync {
// Required methods
fn chain_family(&self) -> &'static str;
fn decode(
&self,
revert_data: &[u8],
ctx: Option<ErrorContext>,
) -> Result<DecodedError, DecodeErrorError>;
// Provided method
fn decode_hex(
&self,
hex_str: &str,
ctx: Option<ErrorContext>,
) -> Result<DecodedError, DecodeErrorError> { ... }
}Expand description
A chain-specific error decoder.
Each chain family (EVM, Solana, …) provides its own implementation.
Implementations must be Send + Sync for use in async contexts.
Required Methods§
Sourcefn chain_family(&self) -> &'static str
fn chain_family(&self) -> &'static str
Returns the chain family name this decoder handles (e.g. "evm").
Sourcefn decode(
&self,
revert_data: &[u8],
ctx: Option<ErrorContext>,
) -> Result<DecodedError, DecodeErrorError>
fn decode( &self, revert_data: &[u8], ctx: Option<ErrorContext>, ) -> Result<DecodedError, DecodeErrorError>
Decode raw revert/error data from a failed transaction.
revert_data is the raw bytes returned by the node in the
revert field (EVM) or equivalent.
On success returns a DecodedError with the highest-confidence
interpretation available. Never returns Err for unknown selectors —
instead returns a RawRevert or Empty kind.
Provided Methods§
Sourcefn decode_hex(
&self,
hex_str: &str,
ctx: Option<ErrorContext>,
) -> Result<DecodedError, DecodeErrorError>
fn decode_hex( &self, hex_str: &str, ctx: Option<ErrorContext>, ) -> Result<DecodedError, DecodeErrorError>
Convenience: decode from a hex string (with or without 0x prefix).