use std::fmt;
#[derive(Debug, Clone)]
pub enum Error {
NoLaws,
ValueCountMismatch { expected: usize, got: usize },
InvalidTolerance(f64),
InvalidTime(f64),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::NoLaws => write!(f, "no conservation laws registered"),
Self::ValueCountMismatch { expected, got } => {
write!(f, "expected {expected} values, got {got}")
}
Self::InvalidTolerance(v) => write!(f, "invalid tolerance: {v}"),
Self::InvalidTime(v) => write!(f, "invalid time: {v}"),
}
}
}
impl std::error::Error for Error {}
pub type Result<T> = std::result::Result<T, Error>;