-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Development of custom error pages is impractical if you need to set kernel.debug=false #3577
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
Changes from 2 commits
2194607
435019c
2fee263
6aa90e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,13 +29,30 @@ control you need: | |
which allows complete control over exception handling. For more | ||
information, see :ref:`kernel-kernel.exception`. | ||
|
||
The default ``ExceptionController`` will either display an | ||
*exception* or *error* page, depending on the setting of the ``kernel | ||
.debug`` flag. While *exception* pages give you a lot of helpful | ||
information during development, *error* pages are meant to be | ||
shown to the end-user. | ||
|
||
.. sidebar:: Testing error pages during development | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Testing Error Pages during Development |
||
|
||
Setting ``kernel.debug`` to ``false`` in order to see your | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's hard to test error pages, since they are not shown when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to avoid saying that something with Symfony2 is hard :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Symfony can be hard in some things, it's bad to deny that imo |
||
error pages during development is impractical as it also stops | ||
Symfony2 from recompiling your twig templates, among other things. | ||
|
||
The third-party `webfactory/exceptions-bundle`_ provides a special | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would use WebfactoryExceptionsBundle. |
||
test controller that allows you to display your custom error | ||
pages for arbitrary HTTP status codes even with ``kernel | ||
.debug`` set to ``true``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
|
||
All of the error templates live inside the TwigBundle. To override the | ||
templates, simply rely on the standard method for overriding templates that | ||
live inside a bundle. For more information, see | ||
:ref:`overriding-bundle-templates`. | ||
|
||
For example, to override the default error template that's shown to the | ||
end-user, create a new template located at | ||
For example, to override the default error template, create a new | ||
template located at | ||
``app/Resources/TwigBundle/views/Exception/error.html.twig``: | ||
|
||
.. code-block:: html+jinja | ||
|
@@ -110,3 +127,5 @@ Symfony uses the following algorithm to determine which template to use: | |
customized in the same way by creating templates such as | ||
``exception.html.twig`` for the standard HTML exception page or | ||
``exception.json.twig`` for the JSON exception page. | ||
|
||
.. _`webfactory/exceptions-bundle`: https://github.com/webfactory/exceptions-bundle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should put
kernel.debug
on one line