Skip to content

Commit 9aa3023

Browse files
committed
Adding more helpful error messages to the Questionhelper
1 parent 940731f commit 9aa3023

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Console/Helper/QuestionHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
271271
// as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false.
272272
if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
273273
shell_exec('stty '.$sttyMode);
274-
throw new MissingInputException('Aborted.');
274+
throw new MissingInputException('Aborted while asking: '.$question->getQuestion());
275275
} elseif ("\177" === $c) { // Backspace Character
276276
if (0 === $numMatches && 0 !== $i) {
277277
--$i;

src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ public function testAskThrowsExceptionOnMissingInput()
750750
public function testAskThrowsExceptionOnMissingInputForChoiceQuestion()
751751
{
752752
$this->expectException(MissingInputException::class);
753-
$this->expectExceptionMessage('Aborted.');
753+
$this->expectExceptionMessage('Aborted while asking: Choice');
754754
(new QuestionHelper())->ask($this->createStreamableInputInterfaceMock($this->getInputStream('')), $this->createOutputInterface(), new ChoiceQuestion('Choice', ['a', 'b']));
755755
}
756756

0 commit comments

Comments
 (0)