Skip to main content

tokenless_core/
error.rs

1use thiserror::Error;
2
3/// Unified error type for the tokenless core crate.
4#[non_exhaustive]
5#[derive(Error, Debug)]
6pub enum CoreError {
7    /// I/O error.
8    #[error("I/O error: {0}")]
9    Io(#[from] std::io::Error),
10
11    /// JSON serialization/deserialization error.
12    #[error("Serialization error: {0}")]
13    Serialization(#[from] serde_json::Error),
14
15    /// Application-level error with a human-readable message.
16    #[error("{0}")]
17    App(String),
18
19    /// Path validation error.
20    #[error("Invalid path: {0}")]
21    Path(String),
22}
23
24/// Convenience type alias for results with [`CoreError`].
25pub type Result<T> = std::result::Result<T, CoreError>;