use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Error {
MalformedEpochs,
Spine(spine::Error),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::MalformedEpochs => {
write!(
f,
"committed epoch timeline is not well-formed at the bound tree size"
)
},
Self::Spine(e) => write!(f, "{e}"),
}
}
}
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::Spine(e) => Some(e),
Self::MalformedEpochs => None,
}
}
}
impl From<spine::Error> for Error {
fn from(e: spine::Error) -> Self {
Self::Spine(e)
}
}
pub type Result<T> = std::result::Result<T, Error>;