Zend\Expressive\TemplatedErrorHandler::handleError PHP Method

handleError() protected method

If a template renderer is present, passes the following to the template specified in the $templateError property: - error (the error itself) - uri - status (response status) - reason (reason associated with response status) - request (full PSR-7 request instance) - response (full PSR-7 response instance) The results of rendering are then written to the response body. This method may be used as an extension point.
protected handleError ( mixed $error, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response ) : Psr\Http\Message\ResponseInterface
$error mixed
$request Psr\Http\Message\RequestInterface
$response Psr\Http\Message\ResponseInterface
return Psr\Http\Message\ResponseInterface
    protected function handleError($error, Request $request, Response $response)
    {
        if ($this->renderer) {
            $response->getBody()->write($this->renderer->render($this->templateError, ['uri' => $request->getUri(), 'error' => $error, 'status' => $response->getStatusCode(), 'reason' => $response->getReasonPhrase(), 'request' => $request, 'response' => $response]));
        }
        return $response;
    }