Added information when an error occured during validation of an answer of a question

This commit is contained in:
Saro0h 2014-12-02 16:05:28 +01:00 committed by Fabien Potencier
parent 6104fe0234
commit 111b1948f2
1 changed files with 7 additions and 1 deletions

View File

@ -355,7 +355,13 @@ class QuestionHelper extends Helper
$attempts = $question->getMaxAttempts();
while (null === $attempts || $attempts--) {
if (null !== $error) {
$output->writeln($this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'));
if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
$message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
} else {
$message = '<error>'.$error->getMessage().'</error>';
}
$output->writeln($message);
}
try {