1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum EvalError {
8 #[error("Insufficient data: need at least {required} samples, got {actual}")]
10 InsufficientData { required: usize, actual: usize },
11
12 #[error("Invalid parameter: {0}")]
14 InvalidParameter(String),
15
16 #[error("Statistical computation error: {0}")]
18 StatisticalError(String),
19
20 #[error("IO error: {0}")]
22 IoError(#[from] std::io::Error),
23
24 #[error("Serialization error: {0}")]
26 SerializationError(#[from] serde_json::Error),
27
28 #[error("Missing required data: {0}")]
30 MissingData(String),
31
32 #[error("Threshold exceeded for {metric}: {value} (threshold: {threshold})")]
34 ThresholdExceeded {
35 metric: String,
36 value: f64,
37 threshold: f64,
38 },
39}
40
41pub type EvalResult<T> = Result<T, EvalError>;