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