Skip to content

Commit 93a056b

Browse files
committed
Tweaks
1 parent 17d83d8 commit 93a056b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

controller/error_pages.rst

+6-8
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,12 @@ store the HTTP status code and message respectively.
114114
and its required ``getStatusCode()`` method. Otherwise, the ``status_code``
115115
will default to ``500``.
116116

117-
Additionally you have access to the Exception with ``exception``.
118-
This allows you to access any method of :class:`Symfony\\Component\\HttpKernel\\Exception\\HttpException`.
119-
For example, if an exception message has been set, using
120-
``throw $this->createNotFoundException('The product does not exist');``,
121-
this can be accessed with ``{{ exception.message }}``.
122-
You can output the stack trace using ``{{ exception.traceAsString }}``
123-
You should be careful with this though, as it is very likely to expose
124-
sensitive data.
117+
Additionally you have access to the :class:`Symfony\\Component\\HttpKernel\\Exception\\HttpException`
118+
object via the ``exception`` Twig variable. For example, if the exception sets a
119+
message (e.g. using ``throw $this->createNotFoundException('The product does not exist')``),
120+
use ``{{ exception.message }}`` to print that message. You can also output the
121+
stack trace using ``{{ exception.traceAsString }}``, but don't do that for end
122+
users because the trace contains sensitive data.
125123

126124
.. tip::
127125

0 commit comments

Comments
 (0)