refactor
This commit is contained in:
@@ -8,6 +8,7 @@ use axum::{
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum RequestError {
|
||||
EmptyFormElement { name: String },
|
||||
RefererNotFound,
|
||||
@@ -18,6 +19,8 @@ pub enum RequestError {
|
||||
AuthenticationHeaderInvalid { message: String },
|
||||
}
|
||||
|
||||
impl std::error::Error for RequestError {}
|
||||
|
||||
impl fmt::Display for RequestError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
@@ -36,17 +39,22 @@ impl fmt::Display for RequestError {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
Model(models::Error),
|
||||
Request(RequestError),
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum StartError {
|
||||
DatabaseInitError { message: String },
|
||||
DatabaseMigrationError { message: String },
|
||||
}
|
||||
|
||||
impl std::error::Error for StartError {}
|
||||
|
||||
impl fmt::Display for StartError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
@@ -60,8 +68,6 @@ impl fmt::Display for StartError {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for StartError {}
|
||||
|
||||
impl From<sqlx::Error> for StartError {
|
||||
fn from(value: sqlx::Error) -> Self {
|
||||
Self::DatabaseInitError {
|
||||
|
||||
Reference in New Issue
Block a user