reth_engine_primitives/
error.rs

1/// Represents all error cases when handling a new payload.
2///
3/// This represents all possible error cases that must be returned as JSON RCP errors back to the
4/// beacon node.
5#[derive(Debug, thiserror::Error)]
6pub enum BeaconOnNewPayloadError {
7    /// Thrown when the engine task is unavailable/stopped.
8    #[error("beacon consensus engine task stopped")]
9    EngineUnavailable,
10    /// An internal error occurred, not necessarily related to the payload.
11    #[error(transparent)]
12    Internal(Box<dyn core::error::Error + Send + Sync>),
13}
14
15impl BeaconOnNewPayloadError {
16    /// Create a new internal error.
17    pub fn internal<E: core::error::Error + Send + Sync + 'static>(e: E) -> Self {
18        Self::Internal(Box::new(e))
19    }
20}