Skip to content

Commit

Permalink
chore: rm ToRpcError usage from engine crate (#11311)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Sep 28, 2024
1 parent 6828bba commit 65f7e88
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/rpc/rpc-engine-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ workspace = true
reth-chainspec.workspace = true
reth-primitives.workspace = true
reth-rpc-api.workspace = true
reth-rpc-types.workspace = true
reth-storage-api.workspace = true
reth-beacon-consensus.workspace = true
reth-payload-builder.workspace = true
Expand Down
11 changes: 5 additions & 6 deletions crates/rpc/rpc-engine-api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use jsonrpsee_types::error::{
};
use reth_beacon_consensus::{BeaconForkChoiceUpdateError, BeaconOnNewPayloadError};
use reth_payload_primitives::{EngineObjectValidationError, PayloadBuilderError};
use reth_rpc_types::ToRpcError;
use thiserror::Error;

/// The Engine API result type
Expand Down Expand Up @@ -92,15 +91,15 @@ pub enum EngineApiError {
/// The payload or attributes are known to be malformed before processing.
#[error(transparent)]
EngineObjectValidationError(#[from] EngineObjectValidationError),
/// Any other error
/// Any other rpc error
#[error("{0}")]
Other(Box<dyn ToRpcError>),
Other(jsonrpsee_types::ErrorObject<'static>),
}

impl EngineApiError {
/// Crates a new [`EngineApiError::Other`] variant.
pub fn other<E: ToRpcError>(err: E) -> Self {
Self::Other(Box::new(err))
pub const fn other(err: jsonrpsee_types::ErrorObject<'static>) -> Self {
Self::Other(err)
}
}

Expand Down Expand Up @@ -187,7 +186,7 @@ impl From<EngineApiError> for jsonrpsee_types::error::ErrorObject<'static> {
SERVER_ERROR_MSG,
Some(ErrorData::new(error)),
),
EngineApiError::Other(err) => err.to_rpc_error(),
EngineApiError::Other(err) => err,
}
}
}
Expand Down

0 comments on commit 65f7e88

Please sign in to comment.