1#[derive(thiserror::Error, Debug)]
5#[non_exhaustive]
6pub enum Error {
7 #[error("HTTP request failed: {0}")]
9 Http(#[from] reqwest::Error),
10
11 #[error("JSON error: {0}")]
13 Json(#[from] serde_json::Error),
14
15 #[error("I/O error: {0}")]
17 Io(#[from] std::io::Error),
18
19 #[error("API error: errcode={errcode}, errmsg={errmsg}")]
21 Api {
22 errcode: i32,
24 errmsg: String,
26 },
27
28 #[error("Session expired for account, paused until cooldown")]
30 SessionExpired,
31
32 #[error("CDN upload failed: {0}")]
34 CdnUpload(String),
35
36 #[error("Encryption error: {0}")]
38 Crypto(String),
39
40 #[error("Configuration error: {0}")]
42 Config(String),
43
44 #[error("Timeout: {0}")]
46 Timeout(String),
47}
48
49pub type Result<T> = std::result::Result<T, Error>;