mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-28 16:48:13 -05:00
fix: forward sequencer error (#16401)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
//! RPC errors specific to OP.
|
||||
|
||||
use alloy_json_rpc::ErrorPayload;
|
||||
use alloy_rpc_types_eth::{error::EthRpcErrorCode, BlockError};
|
||||
use alloy_transport::{RpcError, TransportErrorKind};
|
||||
use jsonrpsee_types::error::{INTERNAL_ERROR_CODE, INVALID_PARAMS_CODE};
|
||||
@@ -140,18 +141,22 @@ pub enum SequencerClientError {
|
||||
/// Wrapper around an [`RpcError<TransportErrorKind>`].
|
||||
#[error(transparent)]
|
||||
HttpError(#[from] RpcError<TransportErrorKind>),
|
||||
/// Thrown when serializing transaction to forward to sequencer
|
||||
#[error("invalid sequencer transaction")]
|
||||
InvalidSequencerTransaction,
|
||||
}
|
||||
|
||||
impl From<SequencerClientError> for jsonrpsee_types::error::ErrorObject<'static> {
|
||||
fn from(err: SequencerClientError) -> Self {
|
||||
jsonrpsee_types::error::ErrorObject::owned(
|
||||
INTERNAL_ERROR_CODE,
|
||||
err.to_string(),
|
||||
None::<String>,
|
||||
)
|
||||
match err {
|
||||
SequencerClientError::HttpError(RpcError::ErrorResp(ErrorPayload {
|
||||
code,
|
||||
message,
|
||||
data,
|
||||
})) => jsonrpsee_types::error::ErrorObject::owned(code as i32, message, data),
|
||||
err => jsonrpsee_types::error::ErrorObject::owned(
|
||||
INTERNAL_ERROR_CODE,
|
||||
err.to_string(),
|
||||
None::<String>,
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user