Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Using Error Handler in Custom Extension #14

Open
timdreier opened this issue Nov 8, 2022 · 0 comments
Open

[BUG] Using Error Handler in Custom Extension #14

timdreier opened this issue Nov 8, 2022 · 0 comments

Comments

@timdreier
Copy link

Describe the bug
I want to throw a 410 (404) error inside my Controller. However, I only get a blank Page using the error handler.

To Reproduce
Steps to reproduce the behavior:

Call the ErrorHandler in Controller:

$message = 'The page you requested is no longer available.';

$errorHandler = $this->getErrorHandlerFromSite($GLOBALS['TYPO3_REQUEST'], 410);
if ($errorHandler instanceof PageErrorHandlerInterface) {
    $response = $errorHandler->handlePageError($GLOBALS['TYPO3_REQUEST'], $message);
} else {
    $response = $this->handleDefaultError($GLOBALS['TYPO3_REQUEST'], 410, $message);
}

return $this->throwStatus(410, $message, $response->getBody()->getContents());

Expected behavior
Error page shows

Additional context
Interesting: (string) $response->getBody() returns the HTML of the current Page and the Error Page. $response->getBody()->getContents() is a empty string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant