lib_client_google_auth/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur during Google authentication.
4#[derive(Debug, Error)]
5pub enum Error {
6    /// HTTP request failed.
7    #[error("Request failed: {0}")]
8    Request(#[from] reqwest::Error),
9
10    /// Token refresh failed.
11    #[error("Token refresh failed: {message}")]
12    TokenRefresh { message: String },
13
14    /// Invalid credentials file.
15    #[error("Invalid credentials: {0}")]
16    InvalidCredentials(String),
17
18    /// JWT encoding/signing failed.
19    #[error("JWT error: {0}")]
20    Jwt(#[from] jsonwebtoken::errors::Error),
21
22    /// JSON parsing error.
23    #[error("JSON error: {0}")]
24    Json(#[from] serde_json::Error),
25
26    /// IO error reading credentials file.
27    #[error("IO error: {0}")]
28    Io(#[from] std::io::Error),
29
30    /// Token expired and could not be refreshed.
31    #[error("Token expired")]
32    TokenExpired,
33
34    /// OAuth2 authorization failed.
35    #[error("Authorization failed: {0}")]
36    AuthorizationFailed(String),
37}
38
39/// Result type for Google auth operations.
40pub type Result<T> = std::result::Result<T, Error>;