cull_gmail/
error.rs

1use thiserror::Error;
2
3/// Error messages for cull-gmail
4#[derive(Debug, Error)]
5pub enum Error {
6    /// Invalid paging mode option
7    #[error("Invalid paging mode option")]
8    InvalidPagingMode,
9    /// Configuration directory not set
10    #[error("Configuration directory not set")]
11    DirectoryUnset,
12    /// Expansion of home directory in `{0}` failed
13    #[error("Expansion of home directory in `{0}` failed")]
14    HomeExpansionFailed(String),
15    /// No labels found in mailbox
16    #[error("No labels found in mailbox")]
17    NoLabelsFound,
18    /// No rule selector specified (i.e. --id or --label)
19    #[error("No rule selector specified (i.e. --id or --label)")]
20    NoRuleSelector,
21    /// No rule for label
22    #[error("No rule for label {0}")]
23    NoRuleFoundForLabel(String),
24    /// No rule for label
25    #[error("No query string calculated for rule #{0}")]
26    NoQueryStringCalculated(usize),
27    /// No label found in the mailbox
28    #[error("Label {0} not found in the mailbox")]
29    LabelNotFoundInMailbox(String),
30    /// Rule not found for ID
31    #[error("No rule for id {0}")]
32    RuleNotFound(usize),
33    /// Label not found in the rule set
34    #[error("Label `{0}` not found in the rule set")]
35    LabelNotFoundInRules(String),
36    /// Directory creation failed for `{0}`
37    #[error("Directory creation failed for `{0:?}`")]
38    DirectoryCreationFailed((String, Box<std::io::Error>)),
39    /// Error from the google_gmail1 crate
40    #[error(transparent)]
41    GoogleGmail1(#[from] Box<google_gmail1::Error>),
42    /// Error from std::io
43    #[error(transparent)]
44    StdIO(#[from] std::io::Error),
45    /// Error from toml_de
46    #[error(transparent)]
47    TomlDe(#[from] toml::de::Error),
48    /// Error from config
49    #[error(transparent)]
50    Config(#[from] config::ConfigError),
51    /// Invalid message age specification
52    #[error("Invalid message age: {0}")]
53    InvalidMessageAge(String),
54    /// Token not found or missing
55    #[error("Token error: {0}")]
56    TokenNotFound(String),
57    /// File I/O error with context
58    #[error("File I/O error: {0}")]
59    FileIo(String),
60    /// Serialization/deserialization error
61    #[error("Serialization error: {0}")]
62    SerializationError(String),
63}