scirs2_integrate/
error.rs

1//! Error types for the SciRS2 integration module
2
3use thiserror::Error;
4
5/// Integration error type
6#[derive(Error, Debug, Clone)]
7pub enum IntegrateError {
8    /// Computation error (generic error)
9    #[error("Computation error: {0}")]
10    ComputationError(String),
11
12    /// Convergence error (algorithm did not converge)
13    #[error("Convergence error: {0}")]
14    ConvergenceError(String),
15
16    /// Value error (invalid value)
17    #[error("Value error: {0}")]
18    ValueError(String),
19
20    /// Invalid input error
21    #[error("Invalid input: {0}")]
22    InvalidInput(String),
23
24    /// Not implemented error
25    #[error("Not implemented: {0}")]
26    NotImplementedError(String),
27
28    /// Linear system solver error
29    #[error("Linear solve error: {0}")]
30    LinearSolveError(String),
31
32    /// Dimension mismatch error
33    #[error("Dimension mismatch: {0}")]
34    DimensionMismatch(String),
35
36    /// Method switching error
37    #[error("Method switching error: {0}")]
38    MethodSwitchingError(String),
39
40    /// Step size too small error
41    #[error("Step size too small: {0}")]
42    StepSizeTooSmall(String),
43
44    /// Index error
45    #[error("Index error: {0}")]
46    IndexError(String),
47}
48
49/// Result type for integration operations
50pub type IntegrateResult<T> = std::result::Result<T, IntegrateError>;
51
52/// Convenient alias for Result with IntegrateError
53pub type Result<T> = std::result::Result<T, IntegrateError>;