1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

storage: unify the compat login errors

This commit is contained in:
Quentin Gliech
2022-12-07 17:26:28 +01:00
parent 1ddc05ff01
commit f7f65e314b
14 changed files with 314 additions and 359 deletions

View File

@@ -36,7 +36,7 @@ pub(crate) enum RouteError {
ProviderNotFound,
#[error(transparent)]
InternalError(Box<dyn std::error::Error>),
Internal(Box<dyn std::error::Error>),
#[error(transparent)]
Anyhow(#[from] anyhow::Error),
@@ -52,9 +52,7 @@ impl IntoResponse for RouteError {
fn into_response(self) -> axum::response::Response {
match self {
Self::ProviderNotFound => (StatusCode::NOT_FOUND, "Provider not found").into_response(),
Self::InternalError(e) => {
(StatusCode::INTERNAL_SERVER_ERROR, e.to_string()).into_response()
}
Self::Internal(e) => (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()).into_response(),
Self::Anyhow(e) => {
(StatusCode::INTERNAL_SERVER_ERROR, format!("{e:?}")).into_response()
}

View File

@@ -90,7 +90,7 @@ pub(crate) enum RouteError {
MissingCookie,
#[error(transparent)]
InternalError(Box<dyn std::error::Error>),
Internal(Box<dyn std::error::Error>),
#[error(transparent)]
Anyhow(#[from] anyhow::Error),
@@ -111,9 +111,7 @@ impl IntoResponse for RouteError {
fn into_response(self) -> axum::response::Response {
match self {
Self::SessionNotFound => (StatusCode::NOT_FOUND, "Session not found").into_response(),
Self::InternalError(e) => {
(StatusCode::INTERNAL_SERVER_ERROR, e.to_string()).into_response()
}
Self::Internal(e) => (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()).into_response(),
Self::Anyhow(e) => {
(StatusCode::INTERNAL_SERVER_ERROR, format!("{e:?}")).into_response()
}

View File

@@ -66,7 +66,7 @@ pub(crate) enum RouteError {
InvalidFormAction,
#[error(transparent)]
InternalError(Box<dyn std::error::Error>),
Internal(Box<dyn std::error::Error>),
#[error(transparent)]
Anyhow(#[from] anyhow::Error),
@@ -85,9 +85,7 @@ impl IntoResponse for RouteError {
fn into_response(self) -> axum::response::Response {
match self {
Self::LinkNotFound => (StatusCode::NOT_FOUND, "Link not found").into_response(),
Self::InternalError(e) => {
(StatusCode::INTERNAL_SERVER_ERROR, e.to_string()).into_response()
}
Self::Internal(e) => (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()).into_response(),
Self::Anyhow(e) => {
(StatusCode::INTERNAL_SERVER_ERROR, format!("{e:?}")).into_response()
}