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 rule selector specified (i.e. --id or --label)
16    #[error("No rule selector specified (i.e. --id or --label)")]
17    NoRuleSelector,
18    /// No rule for label
19    #[error("No rule for label {0}")]
20    NoRuleFoundForLabel(String),
21    /// No rule for label
22    #[error("No query string calculated for rule #{0}")]
23    NoQueryStringCalculated(usize),
24    /// No label found in the mailbox
25    #[error("Label {0} not found in the mailbox")]
26    LabelNotFoundInMailbox(String),
27    /// Rule not found for ID
28    #[error("No rule for id {0}")]
29    RuleNotFound(usize),
30    /// Label not found in the rule set
31    #[error("Label `{0}` not found in the rule set")]
32    LabelNotFoundInRules(String),
33    /// Directory creation failed for `{0}`
34    #[error("Directory creation failed for `{0:?}`")]
35    DirectoryCreationFailed((String, Box<std::io::Error>)),
36    /// Error from the google_gmail1 crate
37    #[error(transparent)]
38    GoogleGmail1(#[from] Box<google_gmail1::Error>),
39    /// Error from std::io
40    #[error(transparent)]
41    StdIO(#[from] std::io::Error),
42    /// Error from toml_de
43    #[error(transparent)]
44    TomlDe(#[from] toml::de::Error),
45}