1use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum AuthError {
7 #[error("Invalid credentials")]
8 InvalidCredentials,
9
10 #[error("Token expired")]
11 TokenExpired,
12
13 #[error("Invalid token")]
14 InvalidToken,
15
16 #[error("Token generation failed: {0}")]
17 TokenGenerationFailed(String),
18
19 #[error("Key not found")]
20 KeyNotFound,
21
22 #[error("Invalid API key")]
23 InvalidApiKey,
24
25 #[error("OAuth error: {0}")]
26 OAuthError(String),
27
28 #[error("User not found")]
29 UserNotFound,
30
31 #[error("User already exists")]
32 UserAlreadyExists,
33
34 #[error("Password too weak")]
35 WeakPassword,
36
37 #[error("Configuration error: {0}")]
38 ConfigError(String),
39
40 #[error("Database error: {0}")]
41 DatabaseError(String),
42
43 #[error("Cryptographic error: {0}")]
44 CryptoError(String),
45
46 #[error("Internal server error")]
47 InternalError,
48}