kona_engine/task_queue/tasks/finalize/
error.rs1use crate::{
4 EngineTaskError, ForkchoiceTaskError, task_queue::tasks::task::EngineTaskErrorSeverity,
5};
6use alloy_transport::{RpcError, TransportErrorKind};
7use kona_protocol::FromBlockError;
8use thiserror::Error;
9
10#[derive(Debug, Error)]
12pub enum FinalizeTaskError {
13 #[error("Attempted to finalize a block that is not yet safe")]
15 BlockNotSafe,
16 #[error("The block to finalize was not found: Number {0}")]
18 BlockNotFound(u64),
19 #[error(transparent)]
23 FromBlock(#[from] FromBlockError),
24 #[error(transparent)]
26 TransportError(#[from] RpcError<TransportErrorKind>),
27 #[error(transparent)]
29 ForkchoiceUpdateFailed(#[from] ForkchoiceTaskError),
30}
31
32impl EngineTaskError for FinalizeTaskError {
33 fn severity(&self) -> EngineTaskErrorSeverity {
34 match self {
35 Self::BlockNotSafe => EngineTaskErrorSeverity::Critical,
36 Self::BlockNotFound(_) => EngineTaskErrorSeverity::Critical,
37 Self::FromBlock(_) => EngineTaskErrorSeverity::Critical,
38 Self::TransportError(_) => EngineTaskErrorSeverity::Temporary,
39 Self::ForkchoiceUpdateFailed(inner) => inner.severity(),
40 }
41 }
42}