File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments