<?php
// src/Controller/ErrorController.php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class ErrorController extends AbstractController
{
public function show(\Throwable $exception): Response
{
if ($exception instanceof NotFoundHttpException) {
return $this->render('bundles/TwigBundle/Exception/error404.html.twig');
}
// Render a default error page for other exceptions
return $this->render('bundles/TwigBundle/Exception/error.html.twig');
}
}
?>