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 d02c7c4

Browse filesBrowse files
committed
Updates according to GH feedback
1 parent 8e70373 commit d02c7c4
Copy full SHA for d02c7c4

File tree

1 file changed

+28
-9
lines changed
Filter options

1 file changed

+28
-9
lines changed

‎cookbook/controller/error_pages.rst

Copy file name to clipboardExpand all lines: cookbook/controller/error_pages.rst
+28-9Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,32 @@ To use this feature, you need to have a definition in your
169169
resource: "@TwigBundle/Resources/config/routing/errors.xml"
170170
prefix: /_error
171171
172+
.. code-block:: xml
173+
174+
<!-- app/config/routing_dev.xml -->
175+
<?xml version="1.0" encoding="UTF-8" ?>
176+
<routes xmlns="http://symfony.com/schema/routing"
177+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
178+
xsi:schemaLocation="http://symfony.com/schema/routing
179+
http://symfony.com/schema/routing/routing-1.0.xsd">
180+
181+
<import resource="@TwigBundle/Resources/config/routing/errors.xml"
182+
prefix="/_error" />
183+
</routes>
184+
185+
.. code-block:: php
186+
187+
// app/config/routing_dev.php
188+
use Symfony\Component\Routing\RouteCollection;
189+
190+
$collection = new RouteCollection();
191+
$collection->addCollection(
192+
$loader->import("@AcmeHelloBundle/Resources/config/routing.php")
193+
);
194+
$collection->addPrefix("/error");
195+
196+
return $collection;
197+
172198
If you're coming from an older version of Symfony, you might need to
173199
add this to your ``routing_dev.yml`` file. If you're starting from
174200
scratch, the `Symfony Standard Edition`_ already contains it for you.
@@ -183,15 +209,6 @@ With this route added, you can use URLs like
183209
to preview the *error* page for a given status code as HTML or for a
184210
given status code and format.
185211

186-
.. tip::
187-
188-
You should not set ``kernel.debug`` to ``false`` in order to see your
189-
error pages during development. This will also stop
190-
Symfony from recompiling your twig templates, among other things.
191-
192-
.. _`WebfactoryExceptionsBundle`: https://github.com/webfactory/exceptions-bundle
193-
.. _`Symfony Standard Edition`: https://github.com/symfony/symfony-standard/
194-
195212
.. _custom-exception-controller:
196213

197214
Replacing the Default ExceptionController
@@ -329,4 +346,6 @@ several) listeners deal with them.
329346

330347
Good luck!
331348

349+
.. _`WebfactoryExceptionsBundle`: https://github.com/webfactory/exceptions-bundle
350+
.. _`Symfony Standard Edition`: https://github.com/symfony/symfony-standard/
332351
.. _`ExceptionListener`: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

0 commit comments

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