Skip to main content

chaser_gt/
error.rs

1//! Error types for the chaser-gt library.
2
3use thiserror::Error;
4
5/// Main error type for the chaser-gt library.
6#[derive(Error, Debug)]
7pub enum GeekedError {
8    /// HTTP request failed
9    #[error("HTTP request failed: {0}")]
10    Http(#[from] rquest::Error),
11
12    /// Captcha verification failed
13    #[error("Captcha verification failed: {message}")]
14    VerificationFailed { message: String },
15
16    /// Unsupported captcha type
17    #[error("Unsupported captcha type: {0}")]
18    UnsupportedType(String),
19
20    /// Deobfuscation failed
21    #[error("Deobfuscation failed: {0}")]
22    Deobfuscation(String),
23
24    /// Encryption error
25    #[error("Encryption error: {0}")]
26    Encryption(String),
27
28    /// Image processing error
29    #[error("Image processing error: {0}")]
30    ImageProcessing(String),
31
32    /// JSON parsing error
33    #[error("JSON parsing error: {0}")]
34    Json(#[from] serde_json::Error),
35
36    /// IO error
37    #[error("IO error: {0}")]
38    Io(#[from] std::io::Error),
39
40    /// Regex error
41    #[error("Regex error: {0}")]
42    Regex(#[from] regex::Error),
43
44    /// Invalid response from server
45    #[error("Invalid server response: {0}")]
46    InvalidResponse(String),
47
48    /// Cache error
49    #[error("Cache error: {0}")]
50    Cache(String),
51}
52
53/// Result type alias for chaser-gt operations.
54pub type Result<T> = std::result::Result<T, GeekedError>;