blob_indexer/synchronizer/
error.rs

1use crate::{
2    clients::beacon::types::BlockIdResolutionError, slots_processor::error::SlotsProcessorError,
3};
4
5#[derive(Debug, thiserror::Error)]
6pub enum SynchronizerError {
7    #[error(
8        "Failed to parallel process slots from {initial_slot} to {final_slot}:\n{chunk_errors}"
9    )]
10    FailedParallelSlotsProcessing {
11        initial_slot: u32,
12        final_slot: u32,
13        chunk_errors: SlotsChunksErrors,
14    },
15    #[error(transparent)]
16    FailedBlockIdResolution(#[from] BlockIdResolutionError),
17    #[error("Failed to save slot checkpoint for slot {slot}: {error}")]
18    FailedSlotCheckpointSave {
19        slot: u32,
20        error: crate::clients::common::ClientError,
21    },
22    #[error(transparent)]
23    Other(#[from] anyhow::Error),
24}
25
26#[derive(Debug)]
27pub struct SlotsChunksErrors(pub Vec<SlotsProcessorError>);
28
29impl std::fmt::Display for SlotsChunksErrors {
30    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31        for err in self.0.iter() {
32            writeln!(f, "- {}", err)?;
33        }
34        Ok(())
35    }
36}