use std::{
error::Error,
fmt::{self, Display, Formatter},
};
#[derive(Debug)]
pub enum DecimalOperationError {
Overflow,
DivisionByZero,
}
impl Display for DecimalOperationError {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match self {
DecimalOperationError::Overflow => {
write!(f, "An overflow occurred during the operation.")
}
DecimalOperationError::DivisionByZero => {
write!(f, "A division by zero occurred during the operation.")
}
}
}
}
impl Error for DecimalOperationError {}