Skip to main content

so_core/
error.rs

1//! Error types for so-core
2
3use thiserror::Error;
4
5/// Core error type
6#[derive(Error, Debug)]
7pub enum Error {
8    /// Dimension mismatch in arrays or data structures
9    #[error("Dimension mismatch: {0}")]
10    DimensionMismatch(String),
11
12    /// Invalid data (NaN, Inf, etc.)
13    #[error("Invalid data: {0}")]
14    DataError(String),
15
16    /// Invalid formula syntax
17    #[error("Formula error: {0}")]
18    FormulaError(String),
19
20    /// Linear algebra error
21    #[error("Linear algebra error: {0}")]
22    LinearAlgebraError(String),
23
24    /// General error with message
25    #[error("{0}")]
26    Message(String),
27
28    /// Wrapper for other errors
29    #[error(transparent)]
30    Other(#[from] anyhow::Error),
31}
32
33/// Result type alias for convenience
34pub type Result<T> = std::result::Result<T, Error>;