Feature #51459
Allow catching of particular exceptions on property mapping
Status: | New | Start date: | 2013-08-28 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 0% |
|
Category: | MVC | |||
Target version: | - | |||
PHP Version: | Complexity: | |||
Has patch: | No |
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
1public function initializeShowAction() {
2 $productPropertyMappingConfiguration = $this->arguments->getArgument('product')->get.....;
3 $productPropertyMappingConfiguration
4 // ->forProperty('datasheetResource')
5 ->catchTypeConverterException(
6 'TYPO3\Flow\Property\Exception\TargetNotFoundException',
7 1297933823,
8 function(\Exception $exception) use ($controller) {
9 $controller->getResponse->setHeader(404);
10 // ok this is becoming pseudo code now ;)
11 })
12}
History
#1 Updated by Adrian Föder almost 2 years ago
A suggestion is here: https://review.typo3.org/#/c/23422/
#2 Updated by Bastian Waidelich almost 2 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 2 years ago
yep it's to have a chance to ever find it again ;)