Skip to content

Commit

Permalink
feat: show additional request information internally when failing to …
Browse files Browse the repository at this point in the history
…serialize
  • Loading branch information
simongoricar committed Feb 21, 2024
1 parent 93d25db commit 7759a58
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kolomoni/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async fn main() -> Result<()> {
#[allow(clippy::let_and_return)]
let server = HttpServer::new(move || {
let json_extractor_config = actix_web::web::JsonConfig::default()
.error_handler(|payload_error, _| {
.error_handler(|payload_error, request| {
match payload_error {
JsonPayloadError::ContentType => {
APIError::client_error(
Expand All @@ -103,7 +103,9 @@ async fn main() -> Result<()> {
).into()
},
JsonPayloadError::Serialize(error) => {
APIError::internal_reason(format!("Failed to serialize to JSON: {:?}", error)).into()
APIError::internal_reason(
format!("Failed to serialize to JSON: {:?}. Request: {:?}", error, request)
).into()
},
JsonPayloadError::Deserialize(_) => {
APIError::client_error(
Expand Down

0 comments on commit 7759a58

Please sign in to comment.