rsl_interpolation/
error.rs

1const DOMAIN_ERROR_MSG: &str =
2    "Supplied value is outside the range of the supplied xdata or ydata.";
3
4#[derive(thiserror::Error, Debug)]
5/// The error type for Interpolator creation and data checking.
6pub enum InterpolationError {
7    /// x points dataset is not sorted.
8    #[error("x values must be strictly increasing.")]
9    UnsortedDataset,
10
11    /// x and y datasets have different length.
12    #[error("Supplied datasets must be 1D and of equal length.")]
13    DatasetMismatch,
14
15    /// Supplied array size is less than the interpolation type's minimum size.
16    #[error("Supplied array size is less than the interpolation type's minimum size.")]
17    NotEnoughPoints,
18
19    /// Suppled z-grid dataset must be 1D with length of `xsize*ysize`.
20    #[error("Suppled z-grid dataset must be 1D with length of `xsize*ysize`.")]
21    ZGridMismatch,
22
23    /// BLAS error solving Tridiagonal linear system.
24    #[error("BLAS error solving Tridiagonal matrix of {which_interp} Interpolator: {source}")]
25    BLASTridiagError {
26        which_interp: String,
27        #[source]
28        source: ndarray_linalg::error::LinalgError,
29    },
30
31    /// Supplied value is outside the range of the supplied xdata or ydata.
32    #[error("{DOMAIN_ERROR_MSG}")]
33    DomainError(#[from] DomainError),
34
35    /// Invalid Interpolation Type
36    #[error("`{0}`: Invalid Interpolation Type")]
37    InvalidType(Box<str>),
38}
39
40#[derive(thiserror::Error, Debug)]
41#[error("{DOMAIN_ERROR_MSG}")]
42#[non_exhaustive]
43/// Returned  when the supplied value is outside the range of the supplied xdata or ydata.
44pub struct DomainError;