Skip to content

Instantly share code, notes, and snippets.

@rcerrejon
Last active June 8, 2016 09:57
Show Gist options
  • Save rcerrejon/214fbaf8f368ae157aa4 to your computer and use it in GitHub Desktop.
Save rcerrejon/214fbaf8f368ae157aa4 to your computer and use it in GitHub Desktop.
Debug: "An error occurred while trying to call Vendor\ExtKey\Controller\ModelController->showAction()"
protected function errorAction() {
echo 'ErrorAction';
$this->clearCacheOnError();
if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper')) {
echo 'Rewritten Property Mapper';
echo '<pre>';
foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $propertyPath => $errors) {
foreach ($errors as $error) {
$message .= 'Error for ' . $propertyPath . ': ' . $error->render() .
PHP_EOL;
}
echo 'Error: ' . $message;
}
echo '</pre>';
$errorFlashMessage = $this->getErrorFlashMessage();
if ($errorFlashMessage !== FALSE) {
$errorFlashMessageObject = new \TYPO3\CMS\Core\Messaging\FlashMessage(
$errorFlashMessage,
'',
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
);
$this->controllerContext->getFlashMessageQueue()->enqueue($errorFlashMessageObject);
}
$referringRequest = $this->request->getReferringRequest();
if ($referringRequest !== NULL) {
$originalRequest = clone $this->request;
$this->request->setOriginalRequest($originalRequest);
$this->request->setOriginalRequestMappingResults($this->arguments->getValidationResults());
$this->forward($referringRequest->getControllerActionName(), $referringRequest->getControllerName(), $referringRequest->getControllerExtensionName(), $referringRequest->getArguments());
}
$message = 'An error occurred while trying to call ' . get_class($this) . '->' . $this->actionMethodName . '().' . PHP_EOL;
return $message;
} else {
// @deprecated since Extbase 1.4.0, will be removed two versions after Extbase 6.1
$this->request->setErrors($this->argumentsMappingResults->getErrors());
$errorFlashMessage = $this->getErrorFlashMessage();
if ($errorFlashMessage !== FALSE) {
$errorFlashMessageObject = new \TYPO3\CMS\Core\Messaging\FlashMessage(
$errorFlashMessage,
'',
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
);
$this->controllerContext->getFlashMessageQueue()->enqueue($errorFlashMessageObject);
}
$referrer = $this->request->getInternalArgument('__referrer');
if ($referrer !== NULL) {
$this->forward($referrer['actionName'], $referrer['controllerName'], $referrer['extensionName'], $this->request->getArguments());
}
$message = 'An error occurred while trying to call ' . get_class($this) . '->' . $this->actionMethodName . '().' . PHP_EOL;
return $message;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment