Skip to content

Commit 76bc51d

Browse files
committed
Log raw JSON when fetching the JSON content from a request fails
1 parent e1979a2 commit 76bc51d

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
3.3.1 (unreleased)
2+
=====
3+
4+
* (improvement) Log raw JSON when fetching the JSON content from a request fails.
5+
6+
17
3.3.0
28
=====
39

src/Controller/BaseController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ public function fetchJsonRequestBody (Request $request, bool $allowInvalid = fal
9595
}
9696
catch (\JsonException $exception)
9797
{
98+
$this->getLogger()->error("Parsing JSON payload failed: {message}", [
99+
"message" => $exception->getMessage(),
100+
"exception" => $exception,
101+
"json" => $raw,
102+
]);
103+
98104
throw new InvalidJsonRequestException(
99105
\sprintf("Parsing JSON payload failed: %s", $exception->getMessage()),
100106
400,

0 commit comments

Comments
 (0)