2022-06-23 09:52:48 +00:00
|
|
|
use thiserror::Error;
|
|
|
|
|
2022-09-18 13:25:42 +00:00
|
|
|
#[derive(Debug, Error, PartialEq, Eq, PartialOrd, Ord)]
|
2022-04-16 22:09:23 +00:00
|
|
|
pub enum Error {
|
2022-09-18 13:14:25 +00:00
|
|
|
#[error("User not found")]
|
2022-04-21 18:54:53 +00:00
|
|
|
UserNotFound,
|
2022-09-18 13:14:25 +00:00
|
|
|
#[error("Failed to open database: {0}")]
|
2022-09-18 13:25:42 +00:00
|
|
|
OpenDatabase(String),
|
2022-09-18 13:14:25 +00:00
|
|
|
#[error("Failed to open connection with database: {0}")]
|
2022-09-18 13:25:42 +00:00
|
|
|
ConnectDatabase(String),
|
2022-09-18 13:14:25 +00:00
|
|
|
#[error("Failed to get row: {0}")]
|
2022-09-18 13:25:42 +00:00
|
|
|
GetRow(String),
|
2022-09-18 13:14:25 +00:00
|
|
|
#[error("Failed to create all required tables: {0}")]
|
2022-09-18 13:25:42 +00:00
|
|
|
CreateTables(String),
|
2022-09-18 13:14:25 +00:00
|
|
|
#[error("Failed to execute the query: {0}")]
|
2022-09-18 13:25:42 +00:00
|
|
|
Execute(String),
|
2022-04-21 18:54:53 +00:00
|
|
|
}
|
2022-06-23 09:52:48 +00:00
|
|
|
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|