reth_prune/error.rs
1use reth_errors::{DatabaseError, RethError};
2use reth_provider::ProviderError;
3use reth_prune_types::PruneSegmentError;
4use thiserror::Error;
5
6/// Errors that can occur during pruning.
7#[derive(Error, Debug)]
8pub enum PrunerError {
9 #[error(transparent)]
10 PruneSegment(#[from] PruneSegmentError),
11
12 #[error("inconsistent data: {0}")]
13 InconsistentData(&'static str),
14
15 #[error(transparent)]
16 Database(#[from] DatabaseError),
17
18 #[error(transparent)]
19 Provider(#[from] ProviderError),
20}
21
22impl From<PrunerError> for RethError {
23 fn from(err: PrunerError) -> Self {
24 match err {
25 PrunerError::PruneSegment(_) | PrunerError::InconsistentData(_) => Self::other(err),
26 PrunerError::Database(err) => Self::Database(err),
27 PrunerError::Provider(err) => Self::Provider(err),
28 }
29 }
30}