Skip to main content

truman_core/
error.rs

1use thiserror::Error;
2
3/// Top-level error type for the truman workspace.
4#[derive(Debug, Error)]
5pub enum TrumanError {
6    #[error("io error on {path}: {source}")]
7    Io {
8        path: String,
9        #[source]
10        source: std::io::Error,
11    },
12
13    #[error("json error: {0}")]
14    Json(#[from] serde_json::Error),
15
16    #[error("regex error: {0}")]
17    Regex(#[from] regex::Error),
18
19    #[error("scan error on {path}: {message}")]
20    Scan { path: String, message: String },
21
22    #[error("{0}")]
23    Other(String),
24}
25
26/// Convenience alias.
27pub type Result<T> = std::result::Result<T, TrumanError>;