diff --git a/fastn-core/src/catch_panic.rs b/fastn-core/src/catch_panic.rs index 21985d23f6..e5fd83e6c3 100644 --- a/fastn-core/src/catch_panic.rs +++ b/fastn-core/src/catch_panic.rs @@ -84,12 +84,16 @@ where .map(move |res| match res { Ok(Ok(res)) => Ok(res), Ok(Err(svc_err)) => Err(svc_err), - Err(_panic_err) => Err(error::ErrorInternalServerError("500 Server Error")), + Err(_panic_err) => Err(error::ErrorInternalServerError( + INTERNAL_SERVER_ERROR_MESSAGE, + )), }) .boxed_local() } } +const INTERNAL_SERVER_ERROR_MESSAGE: &str = "500 Server Error"; + #[cfg(test)] mod tests { use actix_web::{ @@ -146,6 +150,6 @@ mod tests { let res = err.error_response(); assert_eq!(res.status(), StatusCode::INTERNAL_SERVER_ERROR); let body = to_bytes(res.into_body()).await.unwrap(); - assert!(body.is_empty()); + assert_eq!(body, INTERNAL_SERVER_ERROR_MESSAGE) } }