2022-06-07 20:36:26 +00:00
|
|
|
#[derive(Debug, thiserror::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-06-07 20:36:26 +00:00
|
|
|
|
|
|
|
#[error("sqlx error - {0}")]
|
2022-04-19 11:05:47 +00:00
|
|
|
SQLx(sqlx::Error),
|
2022-06-07 20:36:26 +00:00
|
|
|
|
|
|
|
#[error("std::io error - {0}")]
|
2022-04-21 18:54:53 +00:00
|
|
|
Io(std::io::Error),
|
2022-04-16 22:09:23 +00:00
|
|
|
}
|
|
|
|
|
2022-06-08 17:08:06 +00:00
|
|
|
/// sqlx::Error
|
2022-04-19 11:05:47 +00:00
|
|
|
impl From<sqlx::Error> for Error {
|
|
|
|
fn from(err: sqlx::Error) -> Self {
|
|
|
|
Error::SQLx(err)
|
2022-04-16 22:09:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-08 17:08:06 +00:00
|
|
|
/// std::io::Error
|
2022-04-21 18:54:53 +00:00
|
|
|
impl From<std::io::Error> for Error {
|
|
|
|
fn from(err: std::io::Error) -> Self {
|
|
|
|
Error::Io(err)
|
|
|
|
}
|
|
|
|
}
|