public function onKernelException(GetResponseForExceptionEvent $event)
    {
        if ($event->getException() instanceof DisplayBlockException) {
            $event->getRequest()->setRequestFormat('fragment.'. $event->getRequest()->getRequestFormat());
            $event->setException($event->getException()->getPrevious());
        } elseif ($event->getException() instanceof HttpExceptionInterface && '404' == $event->getException()->getStatusCode()) {
            $this->setCurrentSiteInfo(trim($this->request->getHost(), '/'), trim($this->request->getPathInfo(), '/'));

            if ($html = $this->getCustom404Html()) {
                $event->setResponse(new Response($html, 404));
            }
        }
    }