Skip to main content

propaga_core/
error.rs

1use crate::VariableId;
2use thiserror::Error;
3
4/// Errors returned by the propagation engine.
5#[derive(Debug, Error, PartialEq, Eq)]
6pub enum PropagaError {
7    /// A variable domain became empty during propagation.
8    #[error("domain of variable {0:?} is empty")]
9    DomainEmpty(VariableId),
10
11    /// A variable handle does not exist in the engine.
12    #[error("unknown variable {0:?}")]
13    UnknownVariable(VariableId),
14
15    /// A propagator handle does not exist in the engine.
16    #[error("unknown propagator")]
17    UnknownPropagator,
18
19    /// A variable was used with the wrong domain type.
20    #[error("variable {variable:?} expected {expected} domain")]
21    TypeMismatch {
22        /// Variable handle.
23        variable: VariableId,
24        /// Expected domain kind label.
25        expected: String,
26    },
27}