Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5ad1599

Browse filesBrowse files
committed
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.
2 parents 3f4b319 + 859c61d commit 5ad1599
Copy full SHA for 5ad1599

File tree

Expand file treeCollapse file tree

1 file changed

+21
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+21
-2
lines changed

‎cookbook/controller/error_pages.rst

Copy file name to clipboardExpand all lines: cookbook/controller/error_pages.rst
+21-2Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,30 @@ control you need:
2929
which allows complete control over exception handling. For more
3030
information, see :ref:`kernel-kernel.exception`.
3131

32+
The default ``ExceptionController`` will either display an
33+
*exception* or *error* page, depending on the setting of the ``kernel.debug``
34+
flag. While *exception* pages give you a lot of helpful
35+
information during development, *error* pages are meant to be
36+
shown to the end-user.
37+
38+
.. sidebar:: Testing Error Pages during Development
39+
40+
You should not set ``kernel.debug`` to ``false`` in order to see your
41+
error pages during development. This will also stop
42+
Symfony2 from recompiling your twig templates, among other things.
43+
44+
The third-party `WebfactoryExceptionsBundle`_ provides a special
45+
test controller that allows you to display your custom error
46+
pages for arbitrary HTTP status codes even with
47+
``kernel.debug`` set to ``true``.
48+
3249
All of the error templates live inside the TwigBundle. To override the
3350
templates, simply rely on the standard method for overriding templates that
3451
live inside a bundle. For more information, see
3552
:ref:`overriding-bundle-templates`.
3653

37-
For example, to override the default error template that's shown to the
38-
end-user, create a new template located at
54+
For example, to override the default error template, create a new
55+
template located at
3956
``app/Resources/TwigBundle/views/Exception/error.html.twig``:
4057

4158
.. code-block:: html+jinja
@@ -110,3 +127,5 @@ Symfony uses the following algorithm to determine which template to use:
110127
customized in the same way by creating templates such as
111128
``exception.html.twig`` for the standard HTML exception page or
112129
``exception.json.twig`` for the JSON exception page.
130+
131+
.. _`WebfactoryExceptionsBundle`: https://github.com/webfactory/exceptions-bundle

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.