Skip to content

Commit

Permalink
feat: add blockexecution msg fn (#8478)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored May 29, 2024
1 parent 13c9145 commit 1d428cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/evm/execution-errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use reth_consensus::ConsensusError;
use reth_primitives::{revm_primitives::EVMError, BlockNumHash, PruneSegmentError, B256};
use reth_storage_errors::provider::ProviderError;
use std::fmt::Display;
use thiserror::Error;

pub mod trie;
Expand Down Expand Up @@ -118,7 +119,7 @@ pub enum BlockExecutionError {
/// Error when fetching latest block state.
#[error(transparent)]
LatestBlock(#[from] ProviderError),
/// Optimism Block Executor Errors
/// Arbitrary Block Executor Errors
#[error(transparent)]
Other(Box<dyn std::error::Error + Send + Sync>),
}
Expand All @@ -132,6 +133,11 @@ impl BlockExecutionError {
Self::Other(Box::new(error))
}

/// Create a new [BlockExecutionError::Other] from a given message.
pub fn msg(msg: impl Display) -> Self {
Self::Other(msg.to_string().into())
}

/// Returns the inner `BlockValidationError` if the error is a validation error.
pub const fn as_validation(&self) -> Option<&BlockValidationError> {
match self {
Expand Down

0 comments on commit 1d428cb

Please sign in to comment.