Browse Source

redirige vers le referer en cas d’exception

master
vincent 3 months ago
parent
commit
cab955bdbf
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      src/Controller/HomeController.php

+ 6
- 2
src/Controller/HomeController.php View File

@ -19,9 +19,13 @@ class HomeController extends AbstractController
]);
}
public function error($exception, $logger = null): Response
public function error(Request $request, $exception, $logger = null): Response
{
$this->addFlash('danger', 'Erreur ! ' . $exception->getMessage());
$this->addFlash('danger', $exception->getMessage());
if ($request->headers->has('Referer')) {
return $this->redirect($request->headers->get('Referer'));
}
return $this->render('home/error.html.twig', [
]);


Loading…
Cancel
Save