Skip to main content

flow_gate_core/
error.rs

1use crate::traits::{GateId, ParameterName};
2
3#[derive(Debug, Clone, thiserror::Error)]
4pub enum FlowGateError {
5    #[error("Transform parameter error: {0}")]
6    InvalidTransformParam(String),
7
8    #[error("Gate definition is invalid: {0}")]
9    InvalidGate(String),
10
11    #[error("Unknown parameter '{0}' in EventMatrix")]
12    UnknownParameter(ParameterName),
13
14    #[error("Gate '{0}' references unknown gate '{1}'")]
15    UnknownGateReference(GateId, GateId),
16
17    #[error("Gate hierarchy contains a cycle involving gate '{0}'")]
18    CyclicGateReference(GateId),
19
20    #[error("Missing parent gate '{0}' in classification results")]
21    MissingParentGate(GateId),
22
23    #[error("Covariance matrix is not positive-definite")]
24    NotPositiveDefinite,
25
26    #[error("EllipsoidGate dimension mismatch: mean has {0} elements, matrix has {1}×{1}")]
27    DimensionMismatch(usize, usize),
28
29    #[error("XML parse error: {0}")]
30    XmlParse(String),
31
32    #[error("Missing required XML attribute '{0}' on element '{1}'")]
33    MissingAttribute(String, String),
34
35    #[error("Invalid f64 value '{0}' for attribute '{1}'")]
36    InvalidFloat(String, String),
37
38    #[error("BooleanGate '{0}' has NOT operator with {1} operands (expected 1)")]
39    BooleanNotArity(GateId, usize),
40
41    #[error("BooleanGate '{0}' has no operands")]
42    BooleanEmptyOperands(GateId),
43}