Feature #51459

Allow catching of particular exceptions on property mapping

Added by Adrian Föder about 8 years ago. Updated almost 8 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
MVC
Target version:
-
Start date:
2013-08-28
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

I stumbled upon this requirement since I got a TYPO3\Flow\Property\Exception\TargetNotFoundException in the \TYPO3\Flow\Property\TypeConverter\PersistentObjectConverter::fetchObjectFromPersistence method: this one leads to an TYPO3\Flow\Property\Exception exception, hence the custom error view handling is not able to catch the actual exception and result into a 404, for example.

My idea would be to allow one to catch particular property mapping exceptions and call user defined code, this could look, for example, like

public function initializeShowAction() {
    $productPropertyMappingConfiguration = $this->arguments->getArgument('product')->get.....;
    $productPropertyMappingConfiguration
    //  ->forProperty('datasheetResource')
      ->catchTypeConverterException(
          'TYPO3\Flow\Property\Exception\TargetNotFoundException',
          1297933823,
          function(\Exception $exception) use ($controller) {
              $controller->getResponse->setHeader(404);
              // ok this is becoming pseudo code now ;)
          })
}
#2

Updated by Bastian Waidelich almost 8 years ago

Adrian Föder wrote:

A suggestion is here: https://review.typo3.org/#/c/23422/

..which you just abandoned. Mysterious ;)

#3

Updated by Adrian Föder almost 8 years ago

yep it's to have a chance to ever find it again ;)

Also available in: Atom PDF