private function renderErrorScreenByException(GetResponseForExceptionEvent $event)
{
$exception = $event->getException();
$statusCode = $this->getStatusCodeForException($exception);
$this->logException($exception);
// Look for a template
do {
$template = $this->getTemplateForException($exception);
} while (null === $template && null !== ($exception = $exception->getPrevious()));
$this->renderTemplate($template ?: 'error', $statusCode, $event);
}