2022-06-23 09:52:48 +00:00
|
|
|
use thiserror::Error;
|
|
|
|
|
2022-06-08 19:16:12 +00:00
|
|
|
/// Database Error
|
2022-06-23 09:52:48 +00:00
|
|
|
#[derive(Debug, Error)]
|
2022-04-16 22:09:23 +00:00
|
|
|
pub enum Error {
|
2022-06-07 20:36:26 +00:00
|
|
|
#[error("user not found")]
|
2022-04-21 18:54:53 +00:00
|
|
|
UserNotFound,
|
2022-07-12 19:59:11 +00:00
|
|
|
#[error("failed to open database: {0}")]
|
|
|
|
OpenDatabase(sqlx::Error),
|
|
|
|
#[error("failed to connect to the database: {0}")]
|
|
|
|
ConnectDatabase(sqlx::Error),
|
|
|
|
#[error("failed to get row: {0}")]
|
|
|
|
GetRow(sqlx::Error),
|
|
|
|
#[error("failed to execute the query: {0}")]
|
|
|
|
Execute(sqlx::Error),
|
2022-04-21 18:54:53 +00:00
|
|
|
}
|
2022-06-23 09:52:48 +00:00
|
|
|
|
|
|
|
/// Custom Result alias for a [enum@Error].
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|