public function onKernelException(GetResponseForExceptionEvent $event)
{
if ('prod' == $this->kernel->getEnvironment()) {
// exception object
$exception = $event->getException();
$navService = $this->container->get('ssone.cms.navigation');
$logger = $this->container->get('logger');
$logger->error($exception->getMessage());
$host = $navService->host;
// new Response object
$response = new Response();
// set response content
$response->setContent($this->templating->render('SSoneCMSThemeBundle:' . $navService->domainTemplate, array('navigation' => $navService->templateNavigationMap, 'pageClass' => "notfound404", 'pageTitle' => "Not found 404", 'metaDescription' => $navService->metaDescription, 'content' => array("attributes" => array("template" => "404/" . $host . ".html.twig")), 'modules' => "", 'multiLanguageLinks' => "", 'exception' => $exception)));
// HttpExceptionInterface is a special type of exception
// that holds status code and header details
if ($exception instanceof HttpExceptionInterface) {
$response->setStatusCode($exception->getStatusCode());
$response->headers->replace($exception->getHeaders());
} else {
$response->setStatusCode(500);
}
// set the new $response object to the $event
$event->setResponse($response);
}
}