public function errorAction()
{
if ($this->arguments->getValidationResults()->hasErrors()) {
$errors = [];
foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $propertyName => $propertyErrors) {
foreach ($propertyErrors as $propertyError) {
/** @var \Neos\Error\Messages\Error $propertyError */
$error = array('severity' => $propertyError->getSeverity(), 'message' => $propertyError->render());
if ($propertyError->getCode()) {
$error['code'] = $propertyError->getCode();
}
if ($propertyError->getTitle()) {
$error['title'] = $propertyError->getTitle();
}
$errors[$propertyName][] = $error;
}
}
$this->throwStatus(409, null, json_encode($errors));
}
$this->throwStatus(400);
}