Skip to content
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

[TASK] Improve information on ProductionExceptionHandler #4382

Merged
merged 5 commits into from
May 6, 2024
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
Original file line number Diff line number Diff line change
@@ -1,18 +1,71 @@
.. include:: /Includes.rst.txt
.. index::Exceptions; ProductionExceptionHandler
.. _error-handling-production-exception-handler:
.. include:: /Includes.rst.txt
.. index::Exceptions; ProductionExceptionHandler
.. _error-handling-production-exception-handler:

============================
Production Exception Handler
Production exception handler
============================

Functionality of the :php:`\TYPO3\CMS\Core\Error\ProductionExceptionHandler`:

- Shows brief exception message ("Oops, an error occurred!") using
:php:`TYPO3\CMS\Core\Controller\ErrorPageController` and its attendant template.
* Shows brief exception message ("Oops, an error occurred!") using
:php:`\TYPO3\CMS\Core\Controller\ErrorPageController` and its attendant template.
* Logs exception messages via the :ref:`logging API <logging>`.
* Logs exception messages to the sys\_log table. Logged errors are displayed
in the belog extension (:guilabel:`Admin Tools > Log`). This will only work with an
existing DB connection.

- Logs exception messages via the :ref:`logging API <logging>`.
Depending on the :ref:`Logging writer configuration <logging-configuration-writer>`
the exception output can be found for example in the following locations:

- Logs exception messages to the sys\_log table. Logged errors are displayed
in the belog extension (:guilabel:`Admin Tools > Log`). This will only work with an
existing DB connection.
:php:`\TYPO3\CMS\Core\Log\Writer\FileWriter`
In Composer-based installations the information can be found in directory
:path:`var/logs/`. In legacy installations in :path:`typo3temp/var/logs/`.
:php:`\TYPO3\CMS\Core\Log\Writer\SyslogWriter`
Logs exception messages to the :sql:`sys_log` table. Logged errors are displayed
in the backend module :guilabel:`Admin Tools > Log`.

Here you find a complete list of :ref:`Log writers <logging-writers>`.

.. _error-handling-oops-an-error:

Message "Oops, an error occurred!"
==================================

The generic error message "Oops, an error occurred!" is displayed when an
exception or error happens within a TypoScript content object like
:ref:`FLUIDTEMPLATE <t3tsref:cobj-template>` or a plugin. When the exception
affects only one content element or plugin it is displayed in place of that
elements. However, if it affects the content element representing the whole page
like :ref:`PAGEVIEW <t3tsref:cobj-pageview>` only a plain page with this text on
it is displayed.

This message is displayed in :ref:`production context <Environment-context>`
instead of a more detailed exception message. The detailed message can then be
found in the log.

.. _error-handling-oops-an-error-detail:

Show detailed exception output
------------------------------

When the frontend debugging is activated, a detailed exception message is output
instead of the generic "Oops, an error occurred!" message.

By default, debugging is enabled in the
:ref:`TYPO3 contexts <Environment-context>` starting with `Development`. It can
also be enabled by setting
:ref:`config.contentObjectExceptionHandler <t3tsref:setup-config-contentObjectExceptionHandler>`
in TypoScript.

.. _error-handling-oops-an-error-detail-admin:

Example: prevent "Oops, an error occurred!" messages for logged-in admins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: typoscript
:caption: EXT:my_extension/Configuration/TypoScript/setup.typoscript

[backend.user.isAdmin]
config.contentObjectExceptionHandler = 0
[END]
Loading