This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Middleware PSR-15 compliant which handle Exceptions

dev-master 2019-01-10 22:51 UTC

This package is auto-updated.

Last update: 2021-11-11 08:32:52 UTC


This middleware catch any exception thrown by deeper middleware.

For HttpException, a response with its code and message is created. For any other exception, an Internal Error is returned.


Just add the middleware into your dispatcher pipeline at a nested level to catch any exception of deepest middleware.

// @todo: generate request

$dispatcher = new Dispatcher();
$dispatcher->pipe(new CorrelationIdMiddleware());
$dispatcher->pipe(new ExceptionMiddleware());
$dispatcher->pipe(new MyAddMiddleware());

// @todo: add other middleware

$response = $dispatcher->handle($request);