cpkg/
error.rs

1use std::process::ExitStatus;
2
3#[derive(thiserror::Error, Debug)]
4pub enum Error {
5    #[error("Generic error: '{0}'")]
6    Generic(String),
7
8    // TODO: Remove me and replace with specialized error types
9    #[error("Static error: '{0}'")]
10    Static(&'static str),
11
12    #[error("Failed to install color_eyre")]
13    ColorEyreInstall(#[from] color_eyre::Report),
14
15    #[error("IO error")]
16    IO(#[from] std::io::Error),
17
18    #[error("TOML deserialization error")]
19    TOMLDeserialization(#[from] toml::de::Error),
20
21    #[error("TOML serialization error")]
22    TOMLSerialization(#[from] toml::ser::Error),
23
24    #[error("Internal error:\nFailure while parsing command line arguments: '{0}'")]
25    ClapArguments(&'static str),
26
27    #[error("Install command failed with exit code {0}")]
28    InstallCommandFailed(ExitStatus),
29
30    #[error("Remove command failed with exit code {0}")]
31    RemoveCommandFailed(ExitStatus),
32
33    #[error("Reinstall command failed with exit code {0}")]
34    ReinstallCommandFailed(ExitStatus),
35}