Skip to main content

dml_core/
error.rs

1use thiserror::Error;
2
3/// Errors returned by dml-core.
4#[derive(Debug, Error, PartialEq)]
5#[non_exhaustive]
6pub enum DmlError {
7    #[error("dimension mismatch: {0}")]
8    DimensionMismatch(String),
9    #[error("invalid argument: {0}")]
10    InvalidArgument(String),
11    #[error("matrix is singular or not positive definite")]
12    Singular,
13    #[error("learner has not been fitted")]
14    NotFitted,
15    #[error("did not converge: {0}")]
16    Convergence(String),
17    /// An external learner (e.g. a Python estimator) raised an error.
18    #[error("learner failed: {0}")]
19    Learner(String),
20}
21
22pub type Result<T> = std::result::Result<T, DmlError>;