Skip to content
Clone

refactor(space): refresh space error types

zhenyi committed
parent ff4c633 commit bd00877 Browse files

1 file changed

+2 −9

Modified lib/space/error.rs View lib/space/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
76pub type SpaceResult<T> = Result<T, SpaceError>;
@@ -75,11 +74,6 @@
7574 }
7675}
7776
78#[derive(Serialize)]
79struct ErrorBody<'a> {
80 error: &'a str,
81}
82
8377impl IntoResponse for SpaceError {
8478 fn into_response(self) -> Response {
8579 let status = self.status();
@@ -89,7 +83,6 @@
8983 tracing::error!(error = %self, "space internal error");
9084 "internal error".to_string()
9185 };
92 let body = ErrorBody { error: &msg };
93 (status, Json(body)).into_response()
86 AppResponseData::<NoData>::err_plain(status.as_u16() as i32, msg).into_response()
9487 }
9588}
No newline at end of file