1use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum Error {
7 #[error("IO error: {0}")]
8 Io(#[from] std::io::Error),
9
10 #[error("HTTP error: {0}")]
11 Http(#[from] reqwest::Error),
12
13 #[error("JSON error: {0}")]
14 Json(#[from] serde_json::Error),
15
16 #[error("Cask not found: {0}")]
17 CaskNotFound(String),
18
19 #[error("Download failed: {0}")]
20 DownloadFailed(String),
21
22 #[error("Checksum mismatch: expected {expected}, got {actual}")]
23 ChecksumMismatch { expected: String, actual: String },
24
25 #[error("Installation failed: {0}")]
26 InstallFailed(String),
27
28 #[error("Uninstall failed: {0}")]
29 UninstallFailed(String),
30
31 #[error("Mount failed: {0}")]
32 MountFailed(String),
33
34 #[error("Artifact not found: {0}")]
35 ArtifactNotFound(String),
36
37 #[error("Unsupported platform: {0}")]
38 UnsupportedPlatform(String),
39
40 #[error("Command failed: {cmd} - {message}")]
41 CommandFailed { cmd: String, message: String },
42
43 #[error("State error: {0}")]
44 State(String),
45
46 #[error("Invalid input: {0}")]
47 InvalidInput(String),
48}
49
50pub type Result<T> = std::result::Result<T, Error>;