Closed
Description
It is currently quiet hard to test modifications within custom error pages. It involves the following steps:
- Make the exception controller use the right template:
When in development mode the exception controller defaults to use a template called "exception_". In production it searches for "error_". So you either need to switch to production locally or rename your template temporarily. When switching to production locally Twig will start to cache the compiled templates. So you even need to clear the cache after each modification or deactivate caching in your Twig configuration. It is ugly anyway. - Trigger an exception
To actually see the error page, an exception has to be thrown. This might still be easy for 404 exceptions (http://localhost/app.php/there/is/no/page/here...), but is more difficult for other exception types (e.g. 403, 500).
Suggestion:
- The exception controller should offer a way to make him use the "production" templates within development mode. This could be a configuration variable in TwigBundle.
- We could offer routes for exception tests in development mode (e.g. /_exceptions-test/403). This routes would start a controller that just throws the specified exception.
It would be even nicer if calling the test route would implicitly switch to "production" templates without having to reconfigure TwigBundle.
I have already had a look into TwigBundle and could provide a PR if you like the idea.
Or am I overseeing something existing?