1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum IoError {
5 #[error("model has no objective")]
6 NoObjective,
7 #[error("expected an affine expression in {location}, found nonlinear term: {term}")]
8 Nonlinear { location: String, term: String },
9 #[error("second-order cone constraints cannot be represented in this format")]
10 Conic,
11 #[error("unsupported expression node in NL writer: {0}")]
12 UnsupportedNode(&'static str),
13 #[error("variable domain {0} is not representable in NL")]
14 UnsupportedDomain(&'static str),
15 #[error("variable {0} is used in an expression but was not added to this model")]
16 UnknownVar(String),
17 #[error("non-finite numeric value {value} in {location}")]
18 InvalidNumber { value: f64, location: String },
19 #[error("binary NL output is not UTF-8, write it to a byte sink with write_nl_with")]
20 BinaryToString,
21 #[error("io: {0}")]
22 Io(#[from] std::io::Error),
23}