bundle/EventListener/LegacyExceptionListener.php
public function onException(GetResponseForExceptionEvent $event)
    {
        if (!$this->isAdminSiteAccess) {
            return;
        }

        $routeName = $event->getRequest()->attributes->get('_route');
        if ($routeName !== FallbackRouter::ROUTE_NAME) {
            return;
        }

        $exception = $event->getException();
        if (!$exception instanceof NotFoundHttpException) {
            return;
        }

        // We're supporting admin UI exception as well as Netgen
        // internal exception
        if (method_exists($exception, 'getOriginalResponse')) {
            $event->setResponse($exception->getOriginalResponse());
        }
    }
public function onException(GetResponseForExceptionEvent $event)
    {
        if (!$this->isAdminSiteAccess) {
            return;
        }

        $routeName = $event->getRequest()->attributes->get('_route');
        if ($routeName !== FallbackRouter::ROUTE_NAME) {
            return;
        }

        $exception = $event->getException();
        if (!$exception instanceof NotFoundHttpException) {
            return;
        }

        // We're supporting admin UI exception as well as Netgen
        // internal exception
        if (method_exists($exception, 'getOriginalResponse')) {
            $event->setResponse($exception->getOriginalResponse());
        }
    }
Handles the legacy exceptions.

@param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event