mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 09:38:24 -05:00
chore(rpc-types): remove EngineRpcError (#3975)
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
//! Commonly used errors for the `engine_` namespace.
|
||||
|
||||
/// List of Engine API errors used in RPC, see <https://github.com/ethereum/execution-apis/blob/main/src/engine/common.md#errors>
|
||||
///
|
||||
/// Note: These are all errors that can be returned by the `engine_` namespace in the error case.
|
||||
///
|
||||
/// TODO: get rid of this
|
||||
#[derive(Debug, Copy, PartialEq, Eq, Clone, thiserror::Error)]
|
||||
pub enum EngineRpcError {
|
||||
/// Invalid JSON was received by the server.
|
||||
#[error("Invalid JSON was received by the server")]
|
||||
ParseError,
|
||||
/// The JSON sent is not a valid Request object.
|
||||
#[error("The JSON sent is not a valid Request object")]
|
||||
InvalidRequest,
|
||||
/// The method does not exist / is not available.
|
||||
#[error("The method does not exist / is not available")]
|
||||
MethodNotFound,
|
||||
/// Invalid method parameter(s).
|
||||
#[error("Invalid method parameter(s)")]
|
||||
InvalidParams,
|
||||
/// Internal JSON-RPC error.
|
||||
#[error("Internal JSON-RPC error")]
|
||||
InternalError,
|
||||
/// Generic client error while processing request.
|
||||
#[error("Server error")]
|
||||
ServerError,
|
||||
/// Payload does not exist / is not available.
|
||||
#[error("Unknown payload")]
|
||||
UnknownPayload,
|
||||
/// Forkchoice state is invalid / inconsistent.
|
||||
#[error("Invalid forkchoice state")]
|
||||
InvalidForkchoiceState,
|
||||
/// Payload attributes are invalid / inconsistent.
|
||||
#[error("Invalid payload attributes")]
|
||||
InvalidPayloadAttributes,
|
||||
/// Number of requested entities is too large.
|
||||
#[error("Too large request")]
|
||||
TooLargeRequest,
|
||||
}
|
||||
|
||||
impl EngineRpcError {
|
||||
/// Returns the error code as `i32`
|
||||
pub const fn code(&self) -> i32 {
|
||||
match *self {
|
||||
EngineRpcError::ParseError => -32700,
|
||||
EngineRpcError::InvalidRequest => -32600,
|
||||
EngineRpcError::MethodNotFound => -32601,
|
||||
EngineRpcError::InvalidParams => -32602,
|
||||
EngineRpcError::InternalError => -32603,
|
||||
EngineRpcError::ServerError => -32000,
|
||||
EngineRpcError::UnknownPayload => -38001,
|
||||
EngineRpcError::InvalidForkchoiceState => -38002,
|
||||
EngineRpcError::InvalidPayloadAttributes => -38003,
|
||||
EngineRpcError::TooLargeRequest => -38004,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
#![allow(missing_docs)]
|
||||
|
||||
mod error;
|
||||
mod forkchoice;
|
||||
mod payload;
|
||||
mod transition;
|
||||
|
||||
pub use self::{error::*, forkchoice::*, payload::*, transition::*};
|
||||
pub use self::{forkchoice::*, payload::*, transition::*};
|
||||
|
||||
/// The list of supported Engine capabilities
|
||||
pub const CAPABILITIES: [&str; 9] = [
|
||||
|
||||
Reference in New Issue
Block a user