symfony/symfony — pull request #12096 by mpdude (2014-10-02 11:45:34+00:00)
Title: Add an action to show *error* pages in kernel.debug mode

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #7446, #1486, #11327
| License | MIT
| Doc PR | TODO

See #7446 for the initial reasoning. In short, add to your `routing_development.yml` file the following

```yaml
_errors:
resource: "@TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
```

Then you can use `http://localhost/app_dev.php/_error/xxx` to preview the HTML *error* page that the default `ExceptionController` (from `TwigBundle`) would pick for the XXX status code.

You can also use `http://localhost/app_dev.php/_error/xxx/some_format` to show error pages for other formats than HTML, most notably `txt`.

Note that the status code will be 500 for all exceptions [that do not implement `HttpExceptionInterface`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Debug/Exception/FlattenException.php#L47).

##### To be discussed

Folks might want to display (part of) the exception even on error pages and thus need to work with generic (own) exceptions.

They could write an arbitrary controller and throw their exception there. By default, the `ExceptionController` would be used to handle this, only that it would not show *error* pages in `kernel.debug` mode.

Thus, a simple public setter to change the `debug` flag after construction could help. Do we want to add that as well?

##### To-Do
- [ ] Update docs
- [ ] Add route in symfony/symfony-default