-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[2.2] Allow toggling between production and development error pages... #1486
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
Comments
+1 |
1 similar comment
+1 |
It's best to able to turn on error messages for certain IP (your IP) and keep the 404 error pages for everyone else. |
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. |
+1 |
1 similar comment
+1 |
If you are on prod, you can't be on dev ! |
@stephpy how ?! |
@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. |
+1, that could be a good feature. |
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. |
@perprogramming The descriptions says |
+1 |
+1 to allow on error the re-render of production templates on dev env |
Maybe https://packagist.org/packages/webfactory/exceptions-bundle is helpful? |
+1 |
… 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.
👍 would make the styling of production error pages much more comfortable. |
This is going to be fixed by #11327 (this PR should get a |
…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
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.
The text was updated successfully, but these errors were encountered: