ngdp_cache/
error.rs

1//! Error types for the ngdp-cache crate
2
3use thiserror::Error;
4
5/// Result type for ngdp-cache operations
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Error types for cache operations
9#[derive(Debug, Error)]
10pub enum Error {
11    /// Cache directory could not be determined
12    #[error("Could not determine cache directory for the current platform")]
13    CacheDirectoryNotFound,
14
15    /// IO error occurred
16    #[error("IO error: {0}")]
17    Io(#[from] std::io::Error),
18
19    /// The cache entry was not found
20    #[error("Cache entry not found: {0}")]
21    CacheEntryNotFound(String),
22
23    /// Invalid cache key provided
24    #[error("Invalid cache key: {0}")]
25    InvalidCacheKey(String),
26
27    /// Cache corruption detected
28    #[error("Cache corruption detected: {0}")]
29    CacheCorruption(String),
30
31    /// Ribbit client error
32    #[error("Ribbit client error: {0}")]
33    RibbitClient(#[from] ribbit_client::Error),
34
35    /// TACT client error
36    #[error("TACT client error: {0}")]
37    TactClient(#[from] tact_client::Error),
38
39    /// JSON serialization/deserialization error
40    #[error("JSON error: {0}")]
41    Json(#[from] serde_json::Error),
42
43    /// HTTP request error
44    #[error("HTTP request error: {0}")]
45    Http(#[from] reqwest::Error),
46
47    /// CDN client error
48    #[error("CDN client error: {0}")]
49    CdnClient(#[from] ngdp_cdn::Error),
50
51    /// UTF-8 conversion error
52    #[error("UTF-8 conversion error: {0}")]
53    Utf8(#[from] std::string::FromUtf8Error),
54
55    /// Network error
56    #[error("Network error: {0}")]
57    Network(String),
58}