1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum AuthError {
6 #[error("invalid credentials")]
7 InvalidCredentials,
8
9 #[error("email already in use")]
10 EmailTaken,
11
12 #[error("user not found")]
13 UserNotFound,
14
15 #[error("session not found or expired")]
16 SessionNotFound,
17
18 #[error("token invalid or expired")]
19 InvalidToken,
20
21 #[error("email not verified")]
22 EmailNotVerified,
23
24 #[error("password must be at least {0} characters")]
25 WeakPassword(usize),
26
27 #[error("hash error: {0}")]
28 Hash(String),
29
30 #[error("store error: {0}")]
31 Store(String),
32
33 #[error("internal error: {0}")]
34 Internal(String),
35
36 #[error("oauth error: {0}")]
37 OAuth(String),
38}