Skip to content

Commit

Permalink
Fix catch_panic_return_internal_server_error_response test
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpita-Jaiswal committed Nov 7, 2023
1 parent d35198a commit 6484fae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fastn-core/src/catch_panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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)
}
}

0 comments on commit 6484fae

Please sign in to comment.