Skip to main content

oximo_io/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum IoError {
5    #[error("model has no objective")]
6    NoObjective,
7    #[error(
8        "expected a linear or quadratic expression in {location}, found nonlinear term: {term}"
9    )]
10    Nonlinear { location: String, term: String },
11    #[error("second-order cone constraints cannot be represented in this format")]
12    Conic,
13    #[error("unsupported expression node in NL writer: {0}")]
14    UnsupportedNode(&'static str),
15    #[error("AMPL .nl does not document an encoding for nonlinear operator {operator}")]
16    UnsupportedNonlinearOperator { operator: &'static str },
17    #[error("variable domain {0} is not representable in NL")]
18    UnsupportedDomain(&'static str),
19    #[error("variable {0} is used in an expression but was not added to this model")]
20    UnknownVar(String),
21    #[error("non-finite numeric value {value} in {location}")]
22    InvalidNumber { value: f64, location: String },
23    #[error("binary NL output is not UTF-8, write it to a byte sink with write_nl_with")]
24    BinaryToString,
25    #[error("io: {0}")]
26    Io(#[from] std::io::Error),
27    #[error("invalid NL file in {section}: {message}")]
28    InvalidNl { section: String, message: String },
29    #[error("unsupported NL feature in {section}: {feature}")]
30    UnsupportedNl { section: String, feature: String },
31    #[error("invalid LP file at {line}:{column}: {message}")]
32    InvalidLp { line: usize, column: usize, message: String },
33    #[error("unsupported LP feature in {section}: {feature}")]
34    UnsupportedLp { section: String, feature: String },
35    #[error("invalid MPS file at {line}:{column}: {message}")]
36    InvalidMps { line: usize, column: usize, message: String },
37    #[error("unsupported MPS feature in {section}: {feature}")]
38    UnsupportedMps { section: String, feature: String },
39}