When I create an own extension that is using its own records and try to display a details page for a deleted or non existing record there is an TargetNotFoundException
. What is the best / suggested way to display the default 404 page in this case?
Hey Michael,
in TYPO3 v10 you have an ErrorController
to use.
Full example (of ExtensionController showing extension detail in TER):
GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Controller\ErrorController::class)
->pageNotFoundAction(
$GLOBALS['TYPO3_REQUEST'],
'Extension not found!',
['code' => \TYPO3\CMS\Frontend\Page\PageAccessFailureReasons::INVALID_PAGE_ARGUMENTS]
);
I hope it helps after months.