Skip to main content

solow_core/
error.rs

1//! Error and result types shared across the Solow workspace.
2
3use thiserror::Error;
4
5/// The error type returned by fallible Solow operations.
6#[derive(Debug, Error, Clone, PartialEq)]
7pub enum Error {
8    /// A linear-algebra routine failed (non-convergence, ill-conditioning, …).
9    #[error("linear algebra error: {0}")]
10    Linalg(String),
11
12    /// A matrix was singular or not positive-definite where invertibility was required.
13    #[error("singular matrix: {0}")]
14    Singular(String),
15
16    /// An iterative procedure failed to converge.
17    #[error("convergence failure: {0}")]
18    Convergence(String),
19
20    /// An input value was invalid (out of domain, wrong sign, …).
21    #[error("invalid value: {0}")]
22    Value(String),
23
24    /// Array shapes were incompatible.
25    #[error("shape mismatch: {0}")]
26    Shape(String),
27
28    /// The requested feature is recognized but not yet implemented.
29    #[error("not implemented: {0}")]
30    NotImplemented(String),
31}
32
33/// Convenience alias for `Result<T, solow_core::Error>`.
34pub type Result<T> = core::result::Result<T, Error>;