refactor(http): don't return 500 on reload error

This commit is contained in:
Ryan 2025-02-23 17:19:26 -05:00
parent d633820d19
commit 76fd9ea82e
Signed by: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3

View File

@ -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();