private function handleException(GetResponseForExceptionEvent $event)
{
$exception = $event->getException();
switch (true) {
case $this->isBackendUser():
$this->renderBackendException($event);
break;
case $exception instanceof AccessDeniedHttpException:
$this->renderErrorScreenByType(403, $event);
break;
case $exception instanceof NotFoundHttpException:
$this->renderErrorScreenByType(404, $event);
break;
case $exception instanceof ServiceUnavailableHttpException:
$this->renderTemplate('service_unavailable', 503, $event);
break;
default:
$this->renderErrorScreenByException($event);
}
}