zeph_bench/error.rs
1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4/// Errors produced by the benchmark harness.
5///
6/// All fallible public functions in `zeph-bench` return `Result<T, BenchError>`.
7///
8/// # Examples
9///
10/// ```
11/// use zeph_bench::BenchError;
12///
13/// fn example() -> Result<(), BenchError> {
14/// Err(BenchError::DatasetNotFound("tau-bench".into()))
15/// }
16///
17/// assert!(example().is_err());
18/// ```
19#[non_exhaustive]
20#[derive(Debug, thiserror::Error)]
21pub enum BenchError {
22 /// A named dataset was requested but is not registered in [`crate::DatasetRegistry`].
23 #[error("dataset not found: {0}")]
24 DatasetNotFound(String),
25
26 /// An I/O error occurred while reading or writing a dataset or results file.
27 #[error("dataset I/O error: {0}")]
28 Io(#[from] std::io::Error),
29
30 /// The dataset file could not be parsed (wrong schema, corrupt JSON/JSONL, etc.).
31 ///
32 /// The inner `String` carries a human-readable description that includes the line
33 /// number for JSONL formats.
34 #[error("invalid dataset format: {0}")]
35 InvalidFormat(String),
36
37 /// An error propagated from the [`zeph_core::channel::Channel`] implementation.
38 #[error("channel error: {0}")]
39 Channel(#[from] zeph_core::channel::ChannelError),
40
41 /// A catch-all variant for errors that do not fit the above categories.
42 #[error("{0}")]
43 Other(String),
44}