use core::fmt;
use crate::types::branch;
#[derive(Debug, PartialEq, Eq)]
pub enum Error {
NoAddressReported,
UnsupportedFeature(&'static str),
CannotAddBranches(branch::Error),
BranchMapEmpty,
}
impl core::error::Error for Error {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::CannotAddBranches(inner) => Some(inner),
_ => None,
}
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::NoAddressReported => write!(f, "no previous address availible for delta"),
Self::UnsupportedFeature(feat) => write!(f, "feature \"{feat}\" not supported"),
Self::CannotAddBranches(_) => write!(f, "cannot add branches to branch map"),
Self::BranchMapEmpty => write!(f, "the branch map is unexpectedly empty"),
}
}
}