Skip to main content

oximo_core/
error.rs

1use smol_str::SmolStr;
2use thiserror::Error;
3
4/// Errors that can occur during model construction.
5/// These are distinct from backend errors, which are opaque and translated into `SolverError`.
6#[derive(Debug, Error)]
7pub enum Error {
8    #[error("variable name {0:?} already registered")]
9    DuplicateVar(SmolStr),
10    #[error("variable {0:?} not found")]
11    UnknownVar(SmolStr),
12    #[error("constraint {0:?} not found")]
13    UnknownConstraint(SmolStr),
14    #[error("objective already set on this model")]
15    ObjectiveAlreadySet,
16    #[error("nonlinear nodes are not supported by this backend in v0.1")]
17    NonlinearUnsupported,
18    #[error("model has no objective")]
19    NoObjective,
20}
21
22pub type Result<T> = std::result::Result<T, Error>;