Skip to content

Improve error_pages.rst #18331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions controller/error_pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,14 @@ store the HTTP status code and message respectively.
and its required ``getStatusCode()`` method. Otherwise, the ``status_code``
will default to ``500``.

Additionally you have access to the Exception with ``exception``, which for example
allows you to output the stack trace using ``{{ exception.traceAsString }}`` or
access any other method on the object. You should be careful with this though,
as this is very likely to expose sensitive data.
Additionally you have access to the Exception with ``exception``.
This allows you to access any method of :class:`Symfony\\Component\\HttpKernel\\Exception\\HttpException`.
For example, if an exception message has been set, using
``throw $this->createNotFoundException('The product does not exist');``,
this can be accessed with ``{{ exception.message }}``.
You can output the stack trace using ``{{ exception.traceAsString }}``
You should be careful with this though, as it is very likely to expose
sensitive data.

.. tip::

Expand Down