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
|
@ -2203,7 +2203,7 @@ impl Database {
|
||||||
match f(tx).await {
|
match f(tx).await {
|
||||||
Ok(result) => return Ok(result),
|
Ok(result) => return Ok(result),
|
||||||
Err(error) => match error {
|
Err(error) => match error {
|
||||||
Error::Database2(
|
Error::Database(
|
||||||
DbErr::Exec(sea_orm::RuntimeErr::SqlxError(error))
|
DbErr::Exec(sea_orm::RuntimeErr::SqlxError(error))
|
||||||
| DbErr::Query(sea_orm::RuntimeErr::SqlxError(error)),
|
| DbErr::Query(sea_orm::RuntimeErr::SqlxError(error)),
|
||||||
) if error
|
) if error
|
||||||
|
|
|
@ -15,8 +15,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
|
||||||
|
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
Http(StatusCode, String),
|
Http(StatusCode, String),
|
||||||
Database(sqlx::Error),
|
Database(sea_orm::error::DbErr),
|
||||||
Database2(sea_orm::error::DbErr),
|
|
||||||
Internal(anyhow::Error),
|
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 {
|
impl From<sea_orm::error::DbErr> for Error {
|
||||||
fn from(error: sea_orm::error::DbErr) -> Self {
|
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) => {
|
Error::Database(error) => {
|
||||||
(StatusCode::INTERNAL_SERVER_ERROR, format!("{}", &error)).into_response()
|
(StatusCode::INTERNAL_SERVER_ERROR, format!("{}", &error)).into_response()
|
||||||
}
|
}
|
||||||
Error::Database2(error) => {
|
|
||||||
(StatusCode::INTERNAL_SERVER_ERROR, format!("{}", &error)).into_response()
|
|
||||||
}
|
|
||||||
Error::Internal(error) => {
|
Error::Internal(error) => {
|
||||||
(StatusCode::INTERNAL_SERVER_ERROR, format!("{}", &error)).into_response()
|
(StatusCode::INTERNAL_SERVER_ERROR, format!("{}", &error)).into_response()
|
||||||
}
|
}
|
||||||
|
@ -78,7 +68,6 @@ impl std::fmt::Debug for Error {
|
||||||
match self {
|
match self {
|
||||||
Error::Http(code, message) => (code, message).fmt(f),
|
Error::Http(code, message) => (code, message).fmt(f),
|
||||||
Error::Database(error) => error.fmt(f),
|
Error::Database(error) => error.fmt(f),
|
||||||
Error::Database2(error) => error.fmt(f),
|
|
||||||
Error::Internal(error) => error.fmt(f),
|
Error::Internal(error) => error.fmt(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +78,6 @@ impl std::fmt::Display for Error {
|
||||||
match self {
|
match self {
|
||||||
Error::Http(code, message) => write!(f, "{code}: {message}"),
|
Error::Http(code, message) => write!(f, "{code}: {message}"),
|
||||||
Error::Database(error) => error.fmt(f),
|
Error::Database(error) => error.fmt(f),
|
||||||
Error::Database2(error) => error.fmt(f),
|
|
||||||
Error::Internal(error) => error.fmt(f),
|
Error::Internal(error) => error.fmt(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue