I have two “simple questions” that concern the exceptions in Symfony2.
Here follows the description of the problem.
I throw a TokenNotFoundException (or a AccessDeniedException) into a controller. If that exception is thrown, then the framework automatically redirects to the login page.
- Why?
- How can I customize the page to be called after that an exception is throws?
Thanks in advance.
Answer for question 1 :
Look at the Symfony\Component\Security\Http\Firewall\ExceptionListener class. The onKernelException method does the job…