def anti_vowel(text):
t=""
for c in text:
for i in "ieaouIEAOU":
if c==i:
c=""
else:
c=c
t=t+c
return t
Если вы просто возвращаете этот ответ в своем действии, рендеринг страницы выполняется и не прерывается. Передайте ответ в ImmediateResponseException , чтобы ErrorHandler мог его обработать.
$response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
$GLOBALS['TYPO3_REQUEST'],
'Your error message',
['code' => PageAccessFailureReasons::PAGE_NOT_FOUND]
);
throw new ImmediateResponseException($response);