<?php

namespace App\EventListener;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class ExceptionListener
{
	public function __construct(UrlGeneratorInterface $router)
	{
		$this->router = $router;
	}

	public function onKernelException(ExceptionEvent $event)
	{
		// $exception = $event->getException();
		// if ($exception instanceof NotFoundHttpException) {
		// 	$url = $this->router->generate('error404');
		// 	$response = new RedirectResponse($url);
		// 	$event->setResponse($response);
		// }
	}
}
