Skip to content

ErrorHandlerMiddleware

Alexandre Debusschère edited this page Aug 14, 2020 · 1 revision

This middleware should always be the first one in the pipeline.
Indeed, it set up the different error handlers and catch your application exceptions.

Listeners

You can add listeners that will be called everytime an exception is caught.
Here is the listener definition:

function myCustomListener(Throwable $throwable, ServerRequestInterface $request) {};

You can add your own in src/Listener folder then load it/them in the config/container.php file, in the ErrorHandlerMiddleware::class definition.
By default, a monolog listener is added.

Clone this wiki locally