1use reqwest::Error as ReqwestError;
4use std::io;
5use thiserror::Error;
6
7#[derive(Error, Debug)]
9pub enum Error {
10 #[error("HTTP request error: {0}")]
12 Http(#[from] ReqwestError),
13
14 #[error("JSON error: {0}")]
16 Json(#[from] serde_json::Error),
17
18 #[error("IO error: {0}")]
20 Io(#[from] io::Error),
21
22 #[error("API error: {message} (code: {code})")]
24 Api { code: i32, message: String },
25
26 #[error("Authentication error: {0}")]
28 Auth(String),
29
30 #[error("Invalid response: {0}")]
32 InvalidResponse(String),
33
34 #[error("Invalid timestamp: {0}")]
36 InvalidTimestamp(String),
37
38 #[error("Feature '{0}' not supported in API {1}")]
40 UnsupportedFeature(String, String),
41
42 #[error("Two-factor authentication required (session ID: {0})")]
45 TwoFactorRequired(String),
46
47 #[error("CAPTCHA required for login")]
49 CaptchaRequired,
50
51 #[error("CAPTCHA validation failed: {0}")]
53 CaptchaInvalid(String),
54}