Skip to content
Clone

refactor(repo): refresh repo error types

zhenyi committed
parent eb9ba14 commit 6f11fb6 Browse files

1 file changed

+2 −9

Modified lib/repo/error.rs View lib/repo/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 RepoResult<T> = Result<T, RepoError>;
@@ -82,11 +81,6 @@
8281 }
8382}
8483
85#[derive(Serialize)]
86struct ErrorBody<'a> {
87 error: &'a str,
88}
89
9084impl IntoResponse for RepoError {
9185 fn into_response(self) -> Response {
9286 let status = self.status();
@@ -96,7 +90,6 @@
9690 tracing::error!(error = %self, "repo internal error");
9791 "internal error".to_string()
9892 };
99 let body = ErrorBody { error: &msg };
100 (status, Json(body)).into_response()
93 AppResponseData::<NoData>::err_plain(status.as_u16() as i32, msg).into_response()
10194 }
10295}