Skip to main content

dsfb_semiconductor/
error.rs

1// std-only. Excluded from the kernel build by lib.rs.
2// Kernel modules use Option or local error enums where error handling is needed.
3use std::path::PathBuf;
4
5#[derive(Debug, thiserror::Error)]
6pub enum DsfbSemiconductorError {
7    #[error("I/O error: {0}")]
8    Io(#[from] std::io::Error),
9    #[error("CSV error: {0}")]
10    Csv(#[from] csv::Error),
11    #[error("ZIP error: {0}")]
12    Zip(#[from] zip::result::ZipError),
13    #[error("JSON error: {0}")]
14    Json(#[from] serde_json::Error),
15    #[error("dataset format error: {0}")]
16    DatasetFormat(String),
17    #[error("dataset missing: {dataset} not available at {path}")]
18    DatasetMissing {
19        dataset: &'static str,
20        path: PathBuf,
21    },
22    #[error("external command failed: {0}")]
23    ExternalCommand(String),
24    #[error("network fetch failed: {0}")]
25    Network(String),
26    /// Configuration or validation error — e.g., invalid signature schema.
27    #[error("configuration error: {0}")]
28    Config(String),
29}
30
31pub type Result<T> = std::result::Result<T, DsfbSemiconductorError>;