nblm_core/auth/oauth/
error.rs1use reqwest::Error as ReqwestError;
2use serde_json::Error as SerdeJsonError;
3use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum OAuthError {
8 #[error("OAuth client configuration error: {0}")]
9 Config(String),
10
11 #[error("OAuth authorization flow failed: {0}")]
12 Flow(String),
13
14 #[error("Token refresh failed: {0}")]
15 Refresh(String),
16
17 #[error("Token revocation failed: {0}")]
18 Revocation(String),
19
20 #[error("Token storage error: {0}")]
21 Storage(#[from] std::io::Error),
22
23 #[error("CSRF state mismatch: expected {expected}, got {actual}")]
24 StateMismatch { expected: String, actual: String },
25
26 #[error("Missing required environment variable: {0}")]
27 MissingEnvVar(&'static str),
28
29 #[error("HTTP request failed: {0}")]
30 Http(#[from] ReqwestError),
31
32 #[error("Invalid token response: {0}")]
33 InvalidResponse(String),
34
35 #[error("JSON serialization error: {0}")]
36 Json(#[from] SerdeJsonError),
37}
38
39pub type Result<T> = std::result::Result<T, OAuthError>;