1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum WebullError {
6 #[error("Authentication error: {0}")]
8 AuthenticationError(String),
9
10 #[error("API error: {code} - {message}")]
12 ApiError { code: String, message: String },
13
14 #[error("Rate limit exceeded")]
16 RateLimitExceeded,
17
18 #[error("Network error: {0}")]
20 NetworkError(#[from] reqwest::Error),
21
22 #[error("Invalid request: {0}")]
24 InvalidRequest(String),
25
26 #[error("Serialization error: {0}")]
28 SerializationError(#[from] serde_json::Error),
29
30 #[error("MFA required")]
32 MfaRequired,
33
34 #[error("Unauthorized")]
36 Unauthorized,
37
38 #[error("Unknown error: {0}")]
40 Unknown(String),
41}
42
43pub type WebullResult<T> = Result<T, WebullError>;