Skip to content

Commit 0625d64

Browse files
committed
Merge branch '5.4' into 6.2
* 5.4: Update error_pages.rst
2 parents eba48c9 + 93a056b commit 0625d64

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

controller/error_pages.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -114,10 +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``, which for example
118-
allows you to output the stack trace using ``{{ exception.traceAsString }}`` or
119-
access any other method on the object. You should be careful with this though,
120-
as this is very likely to expose 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.
121123

122124
.. tip::
123125

0 commit comments

Comments
 (0)