lighty_auth/
errors.rs

1use thiserror::Error;
2
3/// Authentication errors
4#[derive(Debug, Error)]
5pub enum AuthError {
6    #[error("Invalid credentials")]
7    InvalidCredentials,
8
9    #[error("2FA code required")]
10    TwoFactorRequired,
11
12    #[error("Invalid 2FA code")]
13    Invalid2FACode,
14
15    #[error("Account banned: {0}")]
16    AccountBanned(String),
17
18    #[error("Email not verified")]
19    EmailNotVerified,
20
21    #[error("Network error: {0}")]
22    Network(#[from] reqwest::Error),
23
24    #[error("Invalid response from server: {0}")]
25    InvalidResponse(String),
26
27    #[error("Token expired or invalid")]
28    InvalidToken,
29
30    #[error("User cancelled authentication")]
31    Cancelled,
32
33    #[error("Device code expired")]
34    DeviceCodeExpired,
35
36    #[error("Authentication timeout")]
37    Timeout,
38
39    #[error("Serialization error: {0}")]
40    Serialization(#[from] serde_json::Error),
41
42    #[error("IO error: {0}")]
43    Io(#[from] std::io::Error),
44
45    #[error("{0}")]
46    Custom(String),
47}