Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.2] Allow toggling between production and development error pages... #1486

Closed
atrauzzi opened this issue Jun 30, 2011 · 17 comments

Comments

Projects
None yet
@atrauzzi
Copy link

commented Jun 30, 2011

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.

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.

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.

@lmcd

This comment has been minimized.

Copy link
Contributor

commented Jun 30, 2011

+1

1 similar comment
@sstok

This comment has been minimized.

Copy link
Contributor

commented Feb 23, 2012

+1

@ghost

This comment has been minimized.

Copy link

commented Mar 11, 2012

It's best to able to turn on error messages for certain IP (your IP) and keep the 404 error pages for everyone else.

@atrauzzi

This comment has been minimized.

Copy link
Author

commented Mar 11, 2012

This doesn't solve the issue necessarily. If I am trying to develop or test the 404 page itself, then the ability to toggle would be needed.

@paddya

This comment has been minimized.

Copy link

commented Mar 15, 2012

+1

1 similar comment
@nfx

This comment has been minimized.

Copy link
Contributor

commented Sep 2, 2012

+1

@jeremyFreeAgent

This comment has been minimized.

Copy link
Contributor

commented Sep 13, 2012

If you are on prod, you can't be on dev !

@jeremyFreeAgent

This comment has been minimized.

Copy link
Contributor

commented Sep 13, 2012

@stephpy how ?!

@jeremyFreeAgent

This comment has been minimized.

Copy link
Contributor

commented Sep 13, 2012

@stephpy if you are on prod env, the aim is to not have the same logging level, for best performance. Then if you have prod and dev there is no benefit.

@stephpy

This comment has been minimized.

Copy link
Contributor

commented Sep 13, 2012

+1, that could be a good feature.

@perprogramming

This comment has been minimized.

Copy link

commented Mar 21, 2013

I don't really know if this issue is about having "development error pages" (including stack traces etc.) in "production" or vice versa. Anyway it is related to #7446.

@stof

This comment has been minimized.

Copy link
Member

commented Mar 21, 2013

@perprogramming The descriptions says re-render the request using the production error templates.. So the goal is to see the production error pages while developing (to work on the custom pages)

@sstok

This comment has been minimized.

Copy link
Contributor

commented Apr 9, 2013

+1

@Glideh

This comment has been minimized.

Copy link

commented Jul 17, 2013

+1 to allow on error the re-render of production templates on dev env

@mpdude

This comment has been minimized.

@feitla

This comment has been minimized.

Copy link

commented Mar 8, 2014

+1

weaverryan added a commit to symfony/symfony-docs that referenced this issue Mar 9, 2014

feature #3577 Development of custom error pages is impractical if you…
… need to set kernel.debug=false (mpdude)

This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #3577).

Discussion
----------

Development of custom error pages is impractical if you need to set kernel.debug=false

Also see
symfony/symfony#7446 and symfony/symfony#1486

Commits
-------

6aa90e0 Use WebfactoryExceptionsBundle instead of webfactory/exceptions-bundle
2fee263 Update error_pages.rst
435019c Point out the difference between error and exception pages.
2194607 Add a pointer to webfactory/exceptions-bundle which helps with development of custom error pages.
@apfelbox

This comment has been minimized.

Copy link
Contributor

commented Mar 10, 2014

👍 would make the styling of production error pages much more comfortable.

@wouterj

This comment has been minimized.

Copy link
Member

commented Jul 23, 2014

This is going to be fixed by #11327 (this PR should get a hasPR label).

@jakzal jakzal added the hasPR label Jul 25, 2014

fabpot added a commit that referenced this issue Oct 5, 2014

feature #12096 Add an action to show *error* pages in kernel.debug mo…
…de (mpdude)

This PR was squashed before being merged into the 2.6-dev branch (closes #12096).

Discussion
----------

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        | symfony/symfony-docs#4293

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).

##### Want to test with a custom exception?

~~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?~~

If you want to test error pages with your own exceptions,
* create a subclass of `ExceptionController`
* set the protected `debug` flag to false
* register it as twig.exception_controller in the config
* throw your custom exception from any controller.

That should give you the error page also in `kernel.debug` mode.

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

Commits
-------

66ed177 Add an action to show *error* pages in kernel.debug mode

@fabpot fabpot closed this Oct 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.