Skip to content

Commit

Permalink
Added information when an error occured during validation of an answe…
Browse files Browse the repository at this point in the history
…r of a question
  • Loading branch information
saro0h authored and fabpot committed Dec 8, 2014
1 parent 6104fe0 commit 111b194
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Symfony/Component/Console/Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,13 @@ private function validateAttempts($interviewer, OutputInterface $output, Questio
$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 {
Expand Down

0 comments on commit 111b194

Please sign in to comment.