Skip to main content

asfml_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5    #[error("no session found")]
6    NoSession,
7
8    #[error("session expired or invalid")]
9    InvalidSession,
10
11    #[error("logged in, but {0} is not visible to this session")]
12    NoListAccess(String),
13
14    #[error("email not found: {0}")]
15    EmailNotFound(String),
16
17    #[error("parent not found in archive")]
18    ParentNotFound { in_reply_to: String },
19
20    #[error("invalid mailing list address: {0}")]
21    InvalidListAddress(String),
22
23    #[error("invalid cookie input: {0}")]
24    InvalidCookie(String),
25
26    #[error("could not determine a configuration directory")]
27    ConfigDirUnavailable,
28
29    #[error("Pony Mail API response changed while reading {endpoint}: {reason}")]
30    ApiShapeChanged {
31        endpoint: &'static str,
32        reason: String,
33    },
34
35    #[error("HTTP request failed: {0}")]
36    Http(#[from] reqwest::Error),
37
38    #[error("URL construction failed: {0}")]
39    Url(#[from] url::ParseError),
40
41    #[error("I/O failed: {0}")]
42    Io(#[from] std::io::Error),
43
44    #[error("JSON operation failed: {0}")]
45    Json(#[from] serde_json::Error),
46}
47
48pub type Result<T> = std::result::Result<T, Error>;