Skip to content

Commit 0cc61f7

Browse files
edentjaviereguiluz
authored andcommitted
Update error_pages.rst
I couldn't find any explicit documentation about `{{ exception.message }}` This adds it in and provides a link to to class so that readers can find the other methods available.
1 parent 4d3feea commit 0cc61f7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

controller/error_pages.rst

+8-4
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,14 @@ 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 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.
121125

122126
.. tip::
123127

0 commit comments

Comments
 (0)