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("variable domain {0} is not representable in NL")]
16 UnsupportedDomain(&'static str),
17 #[error("variable {0} is used in an expression but was not added to this model")]
18 UnknownVar(String),
19 #[error("non-finite numeric value {value} in {location}")]
20 InvalidNumber { value: f64, location: String },
21 #[error("binary NL output is not UTF-8, write it to a byte sink with write_nl_with")]
22 BinaryToString,
23 #[error("io: {0}")]
24 Io(#[from] std::io::Error),
25 #[error("invalid NL file in {section}: {message}")]
26 InvalidNl { section: String, message: String },
27 #[error("unsupported NL feature in {section}: {feature}")]
28 UnsupportedNl { section: String, feature: String },
29 #[error("invalid LP file at {line}:{column}: {message}")]
30 InvalidLp { line: usize, column: usize, message: String },
31 #[error("unsupported LP feature in {section}: {feature}")]
32 UnsupportedLp { section: String, feature: String },
33 #[error("invalid MPS file at {line}:{column}: {message}")]
34 InvalidMps { line: usize, column: usize, message: String },
35 #[error("unsupported MPS feature in {section}: {feature}")]
36 UnsupportedMps { section: String, feature: String },
37}