Skip to content

Adds exception template variable available in custom error pages #13214

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
Feb 22, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions components/error_handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ enable each of them separately.
You should never enable the debug tools, except for the error handler, in a
production environment as they might disclose sensitive information to the user.

.. _turning-php-errors-into-exceptions:

Turning PHP Errors into Exceptions
----------------------------------

Expand Down
11 changes: 11 additions & 0 deletions controller/error_pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ 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.

.. tip::

PHP errors are turned into exceptions as well by default, so you can also access these
error details using ``exception``. For more on this see
:ref:`Turning PHP Errors into Exceptions <turning-php-errors-into-exceptions>`

Security & 404 Pages
--------------------

Expand Down