cvxrust/error.rs
1//! Error types for cvxrust.
2
3use thiserror::Error;
4
5/// Error type for cvxrust operations.
6#[derive(Debug, Error)]
7pub enum CvxError {
8 /// Problem is not DCP-compliant.
9 #[error("Problem is not DCP: {0}")]
10 NotDcp(String),
11
12 /// Solver error.
13 #[error("Solver error: {0}")]
14 SolverError(String),
15
16 /// Shape mismatch.
17 #[error("Shape mismatch: expected {expected}, got {got}")]
18 ShapeMismatch { expected: String, got: String },
19
20 /// Invalid problem specification.
21 #[error("Invalid problem: {0}")]
22 InvalidProblem(String),
23
24 /// Numerical error.
25 #[error("Numerical error: {0}")]
26 NumericalError(String),
27}
28
29/// Result type for cvxrust operations.
30pub type Result<T> = std::result::Result<T, CvxError>;