use std::fmt;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum Fault {
DivisionByZero,
Limit,
}
impl fmt::Display for Fault {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Fault::DivisionByZero => "division by zero",
Fault::Limit => "the result's scale exceeds what this host represents",
})
}
}
impl std::error::Error for Fault {}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum DataError {
NotData,
Mismatch,
}
impl fmt::Display for DataError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
DataError::NotData => "the value is not data",
DataError::Mismatch => "the values are not of one type",
})
}
}
impl std::error::Error for DataError {}