Zend\Expressive\WhoopsErrorHandler::handleException PHP Method

handleException() protected method

Calls on prepareWhoopsHandler() to inject additional data tables into the generated payload, and then injects the response with the result of whoops handling the exception.
protected handleException ( Throwable $exception, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response ) : Psr\Http\Message\ResponseInterface
$exception Throwable
$request Psr\Http\Message\RequestInterface
$response Psr\Http\Message\ResponseInterface
return Psr\Http\Message\ResponseInterface
    protected function handleException($exception, Request $request, Response $response)
    {
        // Push the whoops handler if any
        if ($this->whoopsHandler !== null) {
            $this->whoops->pushHandler($this->whoopsHandler);
        }
        // Walk through all handlers
        foreach ($this->whoops->getHandlers() as $handler) {
            // Add fancy data for the PrettyPageHandler
            if ($handler instanceof PrettyPageHandler) {
                $this->prepareWhoopsHandler($request, $handler);
            }
        }
        $response->getBody()->write($this->whoops->handleException($exception));
        return $response;
    }