sigstore_cache/
error.rs

1//! Error types for the cache crate
2
3/// Result type for cache operations
4pub type Result<T> = std::result::Result<T, Error>;
5
6/// Errors that can occur during cache operations
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9    /// I/O error (file operations, etc.)
10    #[error("I/O error: {0}")]
11    Io(String),
12
13    /// Serialization/deserialization error
14    #[error("Serialization error: {0}")]
15    Serialization(String),
16
17    /// Cache entry has expired
18    #[error("Cache entry has expired")]
19    Expired,
20}
21
22impl From<std::io::Error> for Error {
23    fn from(err: std::io::Error) -> Self {
24        Error::Io(err.to_string())
25    }
26}
27
28impl From<serde_json::Error> for Error {
29    fn from(err: serde_json::Error) -> Self {
30        Error::Serialization(err.to_string())
31    }
32}