2022-04-18 12:13:15 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2022-06-23 09:52:48 +00:00
|
|
|
use thiserror::Error;
|
2022-04-18 12:13:15 +00:00
|
|
|
|
2022-06-23 09:52:48 +00:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, Error)]
|
2022-04-18 12:13:15 +00:00
|
|
|
pub enum Error {
|
|
|
|
#[error("user not found")]
|
|
|
|
UserNotFound,
|
|
|
|
#[error("user already exists")]
|
|
|
|
UserAlreadyExists,
|
2022-04-30 19:56:06 +00:00
|
|
|
#[error("username is too short")]
|
|
|
|
UsernameTooShort,
|
|
|
|
#[error("username is too long")]
|
|
|
|
UsernameTooLong,
|
|
|
|
#[error("password is too short")]
|
|
|
|
PasswordTooShort,
|
2022-07-12 19:59:11 +00:00
|
|
|
#[error("failed to generate jwt token")]
|
2022-04-21 18:54:53 +00:00
|
|
|
TokenGenerate,
|
2022-04-23 21:48:20 +00:00
|
|
|
#[error("invalid jwt token")]
|
|
|
|
InvalidToken,
|
2022-06-11 08:19:47 +00:00
|
|
|
#[error("other error - {0}")]
|
|
|
|
Other(String),
|
2022-04-18 12:13:15 +00:00
|
|
|
}
|