public function onKernelException(GetResponseForExceptionEvent $event)
    {
        $exception = $event->getException();
        $response  = null;

        switch (true) {
            case ($exception instanceof NotFoundHttpException):
                $response = $this->createNotFoundResponse($event->getRequest(), $exception);
                break;
            case ($exception instanceof AccessDeniedHttpException):
            case ($exception instanceof UnauthorizedHttpException):
            case ($exception instanceof BadRequestHttpException):
            case ($exception instanceof ServiceUnavailableHttpException):
            case ($exception instanceof NotAcceptableHttpException):
            case ($exception instanceof HttpException):
                /** @var HttpException $exception */
                $response = $this->createHttpExceptionResponse($exception);
                break;
            case ($exception instanceof AuthenticationCredentialsNotFoundException):
                $response = $this->createUnauthenticatedResponse($exception);
                break;
            default:
        }

        if (null === $response) {
            $response = $this->createInternalServerError($exception);
        }

        $event->setResponse($response);
    }