Skip to main content

cova_solver/
error.rs

1//! Error types for optimization solvers
2
3use thiserror::Error;
4
5/// Result type for solver operations
6pub type SolverResult<T> = Result<T, SolverError>;
7
8/// Errors that can occur during optimization
9#[derive(Error, Debug, Clone)]
10pub enum SolverError {
11  /// Dimension mismatch between matrices/vectors
12  #[error("Dimension mismatch: expected {expected}, got {actual}")]
13  DimensionMismatch { expected: String, actual: String },
14
15  /// Invalid problem specification
16  #[error("Invalid problem: {message}")]
17  InvalidProblem { message: String },
18
19  /// Numerical error during computation
20  #[error("Numerical error: {message}")]
21  NumericalError { message: String },
22
23  /// Convergence failure
24  #[error("Failed to converge: {message}")]
25  ConvergenceError { message: String },
26
27  /// Infeasible problem
28  #[error("Problem is infeasible: {message}")]
29  InfeasibleProblem { message: String },
30
31  /// Unbounded problem
32  #[error("Problem is unbounded: {message}")]
33  UnboundedProblem { message: String },
34}