refactor(auth): refresh auth error types
zhenyi committed
Modified lib/auth/error.rs lib/auth/error.rs +2 −9 View lib/auth/error.rs
@@ -1,7 +1,6 @@
1use axum::Json;
21use axum::http::StatusCode;
32use axum::response::{IntoResponse, Response};
4use serde::Serialize;
3use export::data::{AppResponseData, NoData};
54use thiserror::Error;
65
76use cache::redis::RedisError;
@@ -96,11 +95,6 @@
9695 }
9796}
9897
99#[derive(Serialize)]
100struct ErrorBody<'a> {
101 error: &'a str,
102}
103
10498impl IntoResponse for AuthError {
10599 fn into_response(self) -> Response {
106100 let status = self.status();
@@ -110,7 +104,6 @@
110104 tracing::error!(error = %self, "auth internal error");
111105 "internal error".to_string()
112106 };
113 let body = ErrorBody { error: &msg };
114 (status, Json(body)).into_response()
107 AppResponseData::<NoData>::err_plain(status.as_u16() as i32, msg).into_response()
115108 }
116109}