Skip to main content

yscv_eval/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Clone, PartialEq, Error)]
4pub enum EvalError {
5    #[error("invalid IoU threshold: {value}; expected finite threshold in [0, 1]")]
6    InvalidIouThreshold { value: f32 },
7    #[error("invalid score threshold: {value}; expected finite threshold in [0, 1]")]
8    InvalidScoreThreshold { value: f32 },
9    #[error(
10        "count sequence length mismatch: ground_truth={ground_truth}, predictions={predictions}"
11    )]
12    CountLengthMismatch {
13        ground_truth: usize,
14        predictions: usize,
15    },
16    #[error("duration series must contain at least one item")]
17    EmptyDurationSeries,
18    #[error("duration series length mismatch for `{series}`: expected {expected}, got {got}")]
19    DurationSeriesLengthMismatch {
20        expected: usize,
21        got: usize,
22        series: &'static str,
23    },
24    #[error("invalid threshold entry at line {line}: {message}")]
25    InvalidThresholdEntry { line: usize, message: String },
26    #[error("invalid dataset entry at line {line}: {message}")]
27    InvalidDatasetEntry { line: usize, message: String },
28    #[error("invalid dataset format `{format}`: {message}")]
29    InvalidDatasetFormat {
30        format: &'static str,
31        message: String,
32    },
33    #[error("dataset I/O error for `{path}`: {message}")]
34    DatasetIo { path: String, message: String },
35    #[error("invalid diagnostics report: {message}")]
36    InvalidDiagnosticsReport { message: String },
37    #[error("diagnostics report I/O error for `{path}`: {message}")]
38    DiagnosticsReportIo { path: String, message: String },
39}