Remove stale Error
variant
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
969c314315
commit
1c30767592
2 changed files with 3 additions and 15 deletions
|
@ -15,8 +15,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
|
|||
|
||||
pub enum Error {
|
||||
Http(StatusCode, String),
|
||||
Database(sqlx::Error),
|
||||
Database2(sea_orm::error::DbErr),
|
||||
Database(sea_orm::error::DbErr),
|
||||
Internal(anyhow::Error),
|
||||
}
|
||||
|
||||
|
@ -26,15 +25,9 @@ impl From<anyhow::Error> for Error {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<sqlx::Error> for Error {
|
||||
fn from(error: sqlx::Error) -> Self {
|
||||
Self::Database(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<sea_orm::error::DbErr> for Error {
|
||||
fn from(error: sea_orm::error::DbErr) -> Self {
|
||||
Self::Database2(error)
|
||||
Self::Database(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,9 +56,6 @@ impl IntoResponse for Error {
|
|||
Error::Database(error) => {
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, format!("{}", &error)).into_response()
|
||||
}
|
||||
Error::Database2(error) => {
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, format!("{}", &error)).into_response()
|
||||
}
|
||||
Error::Internal(error) => {
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, format!("{}", &error)).into_response()
|
||||
}
|
||||
|
@ -78,7 +68,6 @@ impl std::fmt::Debug for Error {
|
|||
match self {
|
||||
Error::Http(code, message) => (code, message).fmt(f),
|
||||
Error::Database(error) => error.fmt(f),
|
||||
Error::Database2(error) => error.fmt(f),
|
||||
Error::Internal(error) => error.fmt(f),
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +78,6 @@ impl std::fmt::Display for Error {
|
|||
match self {
|
||||
Error::Http(code, message) => write!(f, "{code}: {message}"),
|
||||
Error::Database(error) => error.fmt(f),
|
||||
Error::Database2(error) => error.fmt(f),
|
||||
Error::Internal(error) => error.fmt(f),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue