src/Controller/ErrorController.php line 10

  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\ErrorHandler\Exception\FlattenException;
  6. class ErrorController extends AbstractController
  7. {
  8.     public function showException(FlattenException $exception): Response
  9.     {
  10.         if ($exception->getStatusCode() === 404) {
  11.             return $this->render('userForm/error404.html.twig');
  12.         }
  13.         // GĂ©rer les autres erreurs (500, 403, etc.)
  14.         return $this->render('bundles/TwigBundle/Exception/error.html.twig', [
  15.             'exception' => $exception,
  16.         ]);
  17.     }
  18. }