The Google Chrome network tab doesn’t seem to display PHP errors properly.
Firefox and Insomnia perfectly show all errors, but chrome just shows
Failed to load response data: No data found for resource with given
identifier
I’ve tried setting the headers 'Content-Type: application/json; charset=utf-8' and a lot of other stuff but nothing seems to work.
Code throwing the error:
dd('Test'); // With symfony/var-dumper package
// OR
throw new Exception('Test');
My error handler:
$payload = [
'error' => [
'message' => $exception->getMessage(),
'code' => $exception->getCode()
]
];
$response->getBody()->write(json_encode($payload));
return $response->withHeader('Content-Type', 'application/json')
->withStatus(500);
Any ideas how I can do this? I’m using plain PHP, with Laravel and Symfony this is no problem at all.
