Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47b1106

Browse files
committed
Do not display short exception trace for built-in console exceptions
1 parent c97c6d4 commit 47b1106

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,9 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
761761
}
762762

763763
$messages = array();
764-
$messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
764+
if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
765+
$messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
766+
}
765767
$messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
766768
if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
767769
$messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));

src/Symfony/Component/Console/Tests/Fixtures/application_renderexception1.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
In Application.php line 615:
32

43
Command "foo" is not defined.
54

src/Symfony/Component/Console/Tests/Fixtures/application_renderexception2.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
In ArrayInput.php line 178:
32

43
The "--foo" option does not exist.
54

src/Symfony/Component/Console/Tests/Fixtures/application_renderexception4.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
In Application.php line 615:
32

43
Command "foo" is not define
54
d.

0 commit comments

Comments
 (0)