Thanks a lot!
Beside our custom handlers, which already returns a
JsonResponse, I’d like to output every exception the application is throwing as a JSON to the user. Currently the
NotFoundHandler uses LaminasViewRender -> PhpRender if a template was found or it returns a
I was looking at the
NotFoundHandlerFactory and tried to override the
'dependencies' => [
'factories' => [
TemplateRendererInterface::class => \Laminas\View\Renderer\JsonRenderer::class
My goal is to always respond in JSON if no specific renderer/template was set. I’ve already tried to use
mezzio/mezzio-problem-details for this purpose. But a custom exception is now rendered as a HTTP 500 error without the exception message body. Isn’t there a simpler way of doing this without additional dependecies?
Thanks a lot