From 76fd9ea82ed3f6feb6ada9a3e5b95e74a5cf2e8a Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 23 Feb 2025 17:19:26 -0500 Subject: [PATCH] refactor(http): don't return 500 on reload error --- src/http.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/http.rs b/src/http.rs index ce19277..3a40fa3 100644 --- a/src/http.rs +++ b/src/http.rs @@ -12,13 +12,9 @@ pub async fn serve( let path = request.uri().path().to_owned(); Ok(match (request.method(), path.as_str()) { - (&Method::POST, "/reload") => match reload(&state.lua, None) { - Ok(()) => Response::new(empty()), - Err(error) => status_code_response( - StatusCode::INTERNAL_SERVER_ERROR, - full(format!("{error:?}")), - ), - }, + (&Method::POST, "/reload") => { + Response::new(full(format!("{:#?}", reload(&state.lua, None)))) + } (&Method::POST, "/eval" | "/exec") => { let bytes = request.into_body().collect().await?.to_bytes();