Skip to main content

entrenar/monitor/inference/counterfactual/
error.rs

1//! Error types for counterfactual operations.
2
3/// Error type for counterfactual operations
4#[derive(Debug, Clone, PartialEq)]
5pub enum CounterfactualError {
6    /// Insufficient data
7    InsufficientData { expected: usize, actual: usize },
8    /// Version mismatch
9    VersionMismatch { expected: u8, actual: u8 },
10}
11
12impl std::fmt::Display for CounterfactualError {
13    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14        match self {
15            CounterfactualError::InsufficientData { expected, actual } => {
16                write!(f, "Insufficient data: expected {expected}, got {actual}")
17            }
18            CounterfactualError::VersionMismatch { expected, actual } => {
19                write!(f, "Version mismatch: expected {expected}, got {actual}")
20            }
21        }
22    }
23}
24
25impl std::error::Error for CounterfactualError {}