src/Controller/ErrorController.php line 11

Open in your IDE?
  1. <?php
  2. // src/Controller/ErrorController.php
  3. namespace App\Controller;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  7. class ErrorController extends AbstractController
  8. {
  9.     public function show(\Throwable $exception): Response
  10.     {
  11.         if ($exception instanceof NotFoundHttpException) {
  12.             return $this->render('bundles/TwigBundle/Exception/error404.html.twig');
  13.         }
  14.         // Render a default error page for other exceptions
  15.         return $this->render('bundles/TwigBundle/Exception/error.html.twig');
  16.     }
  17. }
  18. ?>