/** * {@inheritdoc} */ public function __invoke(ServerRequestInterface $request, ResponseInterface $response, Exception $e) { $response->getBody()->write(sprintf('<h1>HTTP %s: %s</h1><pre>%s</pre>', $e->getStatusCode(), $e->getMessage(), $e->getTraceAsString())); $response = $response->withStatus($e->getStatusCode()); return $response; }