Feature: #104321 - Allow handling of argument mapping exceptions in ActionController
See forge#104321
Description
A new method
handle
has been introduced in
Extbase
\TYPO3\
to improve
handling of exceptions that occur during argument mapping.
The new method supports optional handling of the following exceptions:
\TYPO3\
, which occurs, when a given object UID can not be resolved to an existing record.CMS\ Extbase\ Property\ Exception\ Target Not Found Exception \TYPO3\
, which occurs, when a required action argument is missing.CMS\ Extbase\ Mvc\ Controller\ Exception\ Required Argument Missing Exception
Handling of the exceptions can be enabled globally with the following TypoScript configuration.
config.
tx_ extbase. mvc. show Page Not Found If Target Not Found Exception = 1 config.
tx_ extbase. mvc. show Page Not Found If Required Argument Is Missing Exception = 1
The exception handling can also be configured on extension level with the following TypoScript configuration.
plugin.
tx_ yourextension. mvc. show Page Not Found If Target Not Found Exception = 1 plugin.
tx_ yourextension. mvc. show Page Not Found If Required Argument Is Missing Exception = 1 plugin.
tx_ yourextension_ plugin1. mvc. show Page Not Found If Target Not Found Exception = 1 plugin.
tx_ yourextension_ plugin1. mvc. show Page Not Found If Required Argument Is Missing Exception = 1
By default, these options are set to 0
, which will lead to exceptions
being thrown (and would lead to errors, if not caught). This is the current
behavior of TYPO3.
When setting one of these values to 1
, the configured exceptions will not be thrown.
Instead, a
page
response is propagated, resulting in a 404 error being
shown.
Additionally, extension authors can extend or override the method
handle
in relevant Controllers in order
to implement custom argument mapping exception handling.
Impact
Extension authors can now handle exceptions in implementations of a
Action
,
which are thrown during argument mapping.