mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-26 08:31:04 +00:00
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 {
|
||||
Ok(result) => return Ok(result),
|
||||
Err(error) => match error {
|
||||
Error::Database2(
|
||||
Error::Database(
|
||||
DbErr::Exec(sea_orm::RuntimeErr::SqlxError(error))
|
||||
| DbErr::Query(sea_orm::RuntimeErr::SqlxError(error)),
|
||||
) if error
|
||||
|
|
|
@ -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…
Reference in a new issue