code: public function onKernelException(GetResponseForExceptionEvent $event)
      {
          $exception = $event->getException();
          if ($exception instanceof AuthenticationCredentialsNotFoundException) {
              return new RedirectResponse("/login");
          }
  
          $message = $exception->getMessage();
          if ($exception instanceof NotFoundHttpException || $exception instanceof PageNotPublishedException) {
              $this->render404page($event, $message);
  
              return;
          }
  
          if (!$exception instanceof RedKiteCmsExceptionInterface) {
              DataLogger::log($message, DataLogger::CRITICAL);
  
              if ($this->debug) {
                  return $event;
              }
              $this->setUpResponse($event, $message);
  
              return;
          }
  
          $message = Utils::translateException($message, $exception);
          $this->setUpResponse($event, $message);
  
          DataLogger::log($message, DataLogger::ERROR);
      }
docs: Handles the exceptions
  
  @param GetResponseForExceptionEvent $event