comdirect_rest_api/oauth2/errors.rs
1use thiserror::Error;
2
3/// Errors that can occur during authentication or authorization with the Comdirect API.
4#[derive(Error, Debug)]
5pub enum AuthError {
6 /// Network-related errors (e.g., DNS, connection timeout).
7 #[error("Network error: {0}")]
8 Network(String),
9 /// The access token has expired and cannot be refreshed.
10 #[error("Token expired")]
11 TokenExpired,
12 /// The provided credentials or refresh token were rejected by the server.
13 #[error("Invalid credentials or refresh token: {0}")]
14 InvalidCredentials(String),
15 /// File I/O error (if applicable).
16 #[error("File I/O error: {0}")]
17 Io(#[from] std::io::Error),
18 /// Error returned by the underlying HTTP client.
19 #[error("Request error: {0}")]
20 Request(#[from] reqwest::Error),
21 /// Any other error, typically with a descriptive message from the API.
22 #[error("Other error: {0}")]
23 Other(String),
24}