use core::fmt;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NumerologyError {
EmptyName,
EmptyAddress,
InvalidDate {
year: u32,
month: u32,
day: u32,
},
}
impl fmt::Display for NumerologyError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::EmptyName => write!(f, "name has no usable letters"),
Self::EmptyAddress => write!(f, "address has no usable digits or letters"),
Self::InvalidDate { year, month, day } => {
write!(f, "invalid date {year}-{month:02}-{day:02}")
}
}
}
}
impl std::error::Error for NumerologyError {}