Skip to main content

augurs_forecaster/transforms/
error.rs

1/// An error that can occur during the transformation process.
2#[derive(Debug, thiserror::Error)]
3pub enum Error {
4    /// An error occurred during optimization.
5    #[error("error in optimization: {0}")]
6    Optimize(#[from] argmin::core::Error),
7    /// No best parameter was found during optimization.
8    #[error("no best parameter found")]
9    NoBestParameter,
10    /// The input data did not have a distinct minimum and maximum value.
11    #[error("no min-max found: {0:?}")]
12    MinMaxNotFound(augurs_core::NanMinMaxResult<f64>),
13    /// The transform has not been fitted yet.
14    #[error("transform has not been fitted yet")]
15    NotFitted,
16    /// The input data is empty, or contains only NaN values.
17    #[error("input data is empty, or contains only NaN values")]
18    EmptyData,
19    /// The input data contains non-positive values.
20    #[error("data contains non-positive values")]
21    NonPositiveData,
22    /// The input values contain NaN.
23    #[error("input values must not be NaN")]
24    NaNValue,
25    /// The input lambda must be finite.
26    #[error("input lambda must be finite")]
27    InvalidLambda,
28    /// The variance must be positive.
29    #[error("variance must be positive")]
30    VarianceNotPositive,
31    /// All data must be greater than 0.
32    #[error("all data must be greater than 0")]
33    AllDataNotPositive,
34    /// The input data is not in the valid domain.
35    #[error("invalid domain")]
36    InvalidDomain,
37}
38
39impl From<augurs_core::NanMinMaxResult<f64>> for Error {
40    fn from(e: augurs_core::NanMinMaxResult<f64>) -> Self {
41        Self::MinMaxNotFound(e)
42    }
43}