private function setErrorView($response)
    {
        if (Response::isServerError($response) && $this->logger) {
            $this->logger->error('received a server error response: ' . $response->getStatusCode());
        }
        $stream   = $this->error->getStream($response->getStatusCode(), $response->getData());
        $response = $response->withBody($stream);
        return $response;
    }