Skip to main content

zccache_core/
error.rs

1//! Error types for zccache.
2
3use crate::NormalizedPath;
4
5/// Top-level error type for zccache operations.
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8    #[error("I/O error: {0}")]
9    Io(#[from] std::io::Error),
10
11    #[error("IPC error: {message}")]
12    Ipc { message: String },
13
14    #[error("protocol error: {message}")]
15    Protocol { message: String },
16
17    #[error("cache error: {message}")]
18    Cache { message: String },
19
20    #[error("file not found: {0}")]
21    FileNotFound(NormalizedPath),
22
23    #[error("daemon not running")]
24    DaemonNotRunning,
25
26    #[error("daemon already running")]
27    DaemonAlreadyRunning,
28
29    #[error("configuration error: {message}")]
30    Config { message: String },
31}
32
33/// Convenience result type for zccache operations.
34pub type Result<T> = std::result::Result<T, Error>;