Update error_pages.rst

{% if app.security and is_granted('...') %} still throws an exception during the handling of another exception.

request.ERROR: Exception thrown when handling an exception (Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("The security context contains no authentication token. One possible reason may be that there is no firewall configured for this URL.") in "/path/to/error404.html.twig".) [] []

{% if app.user is not null and is_granted('...') %} solves this issue.