1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
pub mod parse;
use parse::Error as ParseError;
use std::path::PathBuf;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Error parsing data")]
Parse(#[from] ParseError),
#[error("Can't create a source with an empty source list")]
EmptySourceList,
#[error("Can't read file {}", .1.to_string_lossy())]
FileRead(#[source] std::io::Error, PathBuf),
#[error("HTTP error")]
Http(#[from] HttpError),
#[error("Email error")]
Email(#[from] Box<EmailError>),
#[error("Twitter error")]
Twitter(#[from] TwitterError),
}
#[derive(thiserror::Error, Debug)]
pub enum HttpError {
#[error("Failed to init TLS")]
TlsInitFailed(#[source] reqwest::Error),
#[error("Can't send GET request to {1:?}")]
Get(#[source] reqwest::Error, String),
#[error("Reqwest Client wasn't initialized")]
ClientNotInitialized,
}
#[allow(clippy::large_enum_variant)]
#[derive(thiserror::Error, Debug)]
pub enum EmailError {
#[error("IMAP connection error")]
Imap(#[from] ImapError),
#[error("Error parsing email")]
Parse(#[from] mailparse::MailParseError),
}
#[derive(thiserror::Error, Debug)]
pub enum ImapError {
#[error("Failed to init TLS")]
TlsInitFailed(#[source] imap::Error),
#[error("Error authenticating with Google")]
GoogleAuth(#[source] Box<crate::Error>),
#[error("Authentication error")]
Auth(#[source] imap::Error),
#[error(transparent)]
Other(#[from] imap::Error),
}
#[derive(thiserror::Error, Debug)]
pub enum TwitterError {
#[error("Authentication failed")]
Auth(#[source] egg_mode::error::Error),
#[error(transparent)]
Other(#[from] egg_mode::error::Error),
}