use derive_more::{Display, From};
#[derive(Debug, Display, From)]
pub enum BlockStoreError {
SqliteError(rusqlite::Error),
CidError(libipld::cid::Error),
TryFromIntError(std::num::TryFromIntError),
Other(anyhow::Error),
}
impl std::error::Error for BlockStoreError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
BlockStoreError::SqliteError(e) => Some(e),
BlockStoreError::CidError(e) => Some(e),
BlockStoreError::TryFromIntError(e) => Some(e),
BlockStoreError::Other(e) => Some(e.as_ref()),
}
}
}
pub type Result<T> = std::result::Result<T, BlockStoreError>;