Commit e5613e1a authored by Christoph Pascher's avatar Christoph Pascher
Browse files

adding more informative error message to backend

parent 93674110
......@@ -14,7 +14,9 @@ namespace TYPO3\Election\Controller;
* The TYPO3 project - inspiring people to share!
*/
use Doctrine\Common\Util\Debug;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
/**
......@@ -41,4 +43,38 @@ abstract class AbstractProtectedBeController extends AbstractBeController
* @return int
*/
abstract protected function getRequiredUserGroup();
protected function errorAction()
{
$this->clearCacheOnError();
$message="";
foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $propertyPath => $errors) {
foreach ($errors as $error) {
$message .= PHP_EOL. 'Error for ' . $propertyPath . ': ' . $error->render();
}
}
$errorFlashMessage = $this->getErrorFlashMessage();
if ($errorFlashMessage !== FALSE) {
$errorFlashMessageObject = new \TYPO3\CMS\Core\Messaging\FlashMessage(
$errorFlashMessage." ".$message,
'',
\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());
}
DebuggerUtility::var_dump($this->request['nominee.image']);
$message = 'An error occurred while trying to call ' . get_class($this) . '->' . $this->actionMethodName . '().' . PHP_EOL;
return $message;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment