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 {
13 code: String,
14 message: String
15 },
16
17 #[error("Rate limit exceeded")]
19 RateLimitExceeded,
20
21 #[error("Network error: {0}")]
23 NetworkError(#[from] reqwest::Error),
24
25 #[error("Invalid request: {0}")]
27 InvalidRequest(String),
28
29 #[error("Serialization error: {0}")]
31 SerializationError(#[from] serde_json::Error),
32
33 #[error("MFA required")]
35 MfaRequired,
36
37 #[error("Unauthorized")]
39 Unauthorized,
40
41 #[error("Unknown error: {0}")]
43 Unknown(String),
44}
45
46pub type WebullResult<T> = Result<T, WebullError>;