Skip to content

Commit

Permalink
JsonResponse: In case of Tracy is active, log exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Jul 13, 2020
1 parent 4b0a6bf commit abc1ec8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Response/JsonResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

use Nette\Utils\Json;
use Nette\Utils\JsonException;
use Tracy\Debugger;
use Tracy\ILogger;

final class JsonResponse extends BaseResponse
{
Expand All @@ -21,6 +23,10 @@ public function __toString(): string
try {
return $this->getJson();
} catch (JsonException $e) {
if (class_exists('\Tracy\Debugger') === true) {
Debugger::log($e, ILogger::CRITICAL);
}

return '{}';
}
}
Expand Down

0 comments on commit abc1ec8

Please sign in to comment.