Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cookbook/controller/error_pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,24 @@ 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.

Testing Error Pages during development
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During Development

--------------------------------------

The default exception controller,
``Symfony\Bundle\TwigBundle\Controller\ExceptionController``, which is
part of the TwigBundle will show
*exception* pages when you're in ``kernel.debug`` mode and *error*
pages otherwise. Thus, your end users will typically see the *error*
pages.

But setting ``kernel.debug`` to ``false`` during development to write
or test your custom error pages is impractical as it stops Symfony2 from
recompiling the Twig templates, among other things.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] impractical as, among other things, it stops Symfony2 from recompiling the Twig templates.


To help you with that, `webfactory/exceptions-bundle`_ contains a
simple test controller that you can use to trigger custom exceptions. At
the same time, it will make the `ExceptionController` display the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use double backticks

corresponding *error* pages also in ``kernel.debug`` mode.

.. _`webfactory/exceptions-bundle`: https://github.com/webfactory/exceptions-bundle