From 2031d8de41ba72436e156cd82c1b1c0bcb5d8865 Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 13 Apr 2024 04:08:45 +0200 Subject: [PATCH] fix: upub error reports status codes as-is --- src/errors.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index ff1a4736..7029d7f7 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -59,10 +59,11 @@ impl From for UpubError { impl axum::response::IntoResponse for UpubError { fn into_response(self) -> axum::response::Response { - ( - axum::http::StatusCode::INTERNAL_SERVER_ERROR, - self.to_string() - ).into_response() + let descr = self.to_string(); + match self { + UpubError::Status(status) => (status, descr).into_response(), + _ => (axum::http::StatusCode::INTERNAL_SERVER_ERROR, descr).into_response(), + } } }