code: public function onKernelException(GetResponseForExceptionEvent $event): void
      {
          $exception = $event->getException();
  
          if (!$exception instanceof ResponseException) {
              return;
          }
  
          $event->allowCustomResponseCode();
          $event->setResponse($exception->getResponse());
      }
docs: Sets the response from the exception.