Skip to content

[Console] Show code when an exception is thrown #17504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change code condition, sprintf call and code format
  • Loading branch information
maidmaid committed Jan 24, 2016
commit 7f498189e5a1a9e2d87ac4341788f30fb7f4a441
9 changes: 5 additions & 4 deletions src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,11 @@ public function renderException(\Exception $e, OutputInterface $output)
$output->writeln('', OutputInterface::VERBOSITY_QUIET);

do {
$title = $output->isVerbose() && ($code = $e->getCode()) > 0
? sprintf(' [%s - code %s] ', get_class($e), $code)
: sprintf(' [%s] ', get_class($e))
;
$title = sprintf(
' [%s%s] ',
get_class($e),
$output->isVerbose() && ($code = $e->getCode()) !== 0 ? ' ('.$code.')' : ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition should be in yoda style:
0 !== ($code = $e->getCode())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right @paradajozsef, it's done.

);

$len = $this->stringWidth($title);

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy