Skip to content

Commit

Permalink
[Backport 12.4] [TASK] Improve information on ProductionExceptionHand…
Browse files Browse the repository at this point in the history
…ler (#4386)

* [TASK] Improve information on ProductionExceptionHandler

In preparation for documentation of TYPO3-Documentation/Changelog-To-Doc#883

Releases: main, 12.4, 11.5

* Update Documentation/ApiOverview/ErrorAndExceptionHandling/ProductionExceptionHandler/Index.rst

* Update Documentation/ApiOverview/ErrorAndExceptionHandling/ProductionExceptionHandler/Index.rst

* Update Documentation/ApiOverview/ErrorAndExceptionHandling/ProductionExceptionHandler/Index.rst

* Update Documentation/ApiOverview/ErrorAndExceptionHandling/ProductionExceptionHandler/Index.rst

---------

Co-authored-by: lina.wolf <lwolf@w-commerce.de>
Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com>
  • Loading branch information
3 people authored May 6, 2024
1 parent bfd3aa8 commit 3443be3
Showing 1 changed file with 63 additions and 10 deletions.
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]

0 comments on commit 3443be3

Please sign in to comment.