<p dir="auto">It is currently quiet hard to test modifications within custom error pages. It involves the following steps:</p>
<ol dir="auto">
<li>Make the exception controller use the right template:<br>
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.</li>
<li>Trigger an exception<br>
To actually see the error page, an exception has to be thrown. This might still be easy for 404 exceptions (<a href="http://localhost/app.php/there/is/no/page/here" rel="nofollow">http://localhost/app.php/there/is/no/page/here</a>...), but is more difficult for other exception types (e.g. 403, 500).</li>
</ol>
<p dir="auto">Suggestion:</p>
<ol dir="auto">
<li>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.</li>
<li>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.<br>
It would be even nicer if calling the test route would implicitly switch to "production" templates without having to reconfigure TwigBundle.</li>
</ol>
<p dir="auto">I have already had a look into TwigBundle and could provide a PR if you like the idea.</p>
<p dir="auto">Or am I overseeing something existing?</p>
<p dir="auto">When I'm viewing my site in production, I get to take advantage of the extremely useful error pages symfony provides. Unfortunately, this is clobbering my user-facing error pages.</p>
<p dir="auto">It would be nice if somewhere in the ui of the default app_dev error page, a button was made available to re-render the request using the production error templates.</p>
<p dir="auto">I'm going to clarify something ahead of time as I brought this up on IRC and some people struggled to understand the usefulness of this:  Ideally I wouldn't have to re-enter the same URL in the address bar to view the production template. Reason being that I may not have directly navigated to the page I'm viewing.  As a result, things like post variables or anything set server side are not guaranteed to be present.</p>