Skip to main content

steer_auth_plugin/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum AuthError {
5    #[error("Network error: {0}")]
6    Network(#[from] reqwest::Error),
7
8    #[error("Invalid authorization code")]
9    InvalidCode,
10
11    #[error("Storage error: {0}")]
12    Storage(String),
13
14    #[error("Token expired")]
15    Expired,
16
17    #[error("Re-authentication required")]
18    ReauthRequired,
19
20    #[error("OAuth flow cancelled by user")]
21    Cancelled,
22
23    #[error("Failed to start callback server: {0}")]
24    CallbackServer(String),
25
26    #[error("OAuth state mismatch")]
27    StateMismatch,
28
29    #[error("Invalid OAuth response: {0}")]
30    InvalidResponse(String),
31
32    #[error("Keyring error: {0}")]
33    Keyring(#[from] keyring::Error),
34
35    #[error("Encryption error: {0}")]
36    Encryption(String),
37
38    #[error("IO error: {0}")]
39    Io(#[from] std::io::Error),
40
41    #[error("Unsupported authentication method: {method} for provider {provider}")]
42    UnsupportedMethod { method: String, provider: String },
43
44    #[error("Invalid authentication state: {0}")]
45    InvalidState(String),
46
47    #[error("Invalid credential: {0}")]
48    InvalidCredential(String),
49
50    #[error("Missing required input: {0}")]
51    MissingInput(String),
52}
53
54pub type Result<T> = std::result::Result<T, AuthError>;