diff -r 20db884b7028 -r 61b068c50e25 src/error.rs --- a/src/error.rs Mon Oct 24 09:41:43 2022 +0300 +++ b/src/error.rs Mon Oct 24 10:52:19 2022 +0300 @@ -4,5 +4,20 @@ pub type DynResult = Result>; pub type DynError = DynResult<()>; +#[derive(Clone, Debug)] +/// Type for numerical errors. +pub struct NumericalError( + /// Provides additional information about the error + pub &'static str +); +impl std::fmt::Display for NumericalError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self.0 { + "" => write!(f, "Numerical error"), + s => write!(f, "{s}"), + } + } +} +impl std::error::Error for NumericalError {}