Repository navigation
Let exceptions fly while bootstrapping #3
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
Changes from 2 commits
854f2b2
f68f38c
252c458
eb02a32
baa885c
84e8154
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -303,7 +303,7 @@ public static function begin( | |
| })($bootstrapFile); | ||
| } catch (\Throwable $e) { | ||
| $errorOutput->writeln($e->getMessage()); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO, in cases where we throw (this would apply to a few more places within this file)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could print out the stack trace in this place manually. The same way Symfony Console does. Can you investigate what function should we call to do that?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is a IMO having this kind of error handling logik on a command-level is wrong though |
||
| throw new \PHPStan\Command\InceptionNotSuccessfulException(); | ||
| throw new \PHPStan\Command\InceptionNotSuccessfulException($e->getMessage(), 0, $e); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a Exception thrown within a command will automatically lead to a exit-code of
1by symfony-consoleThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I disagree with this change. CommandHelper outputs the error message, InceptionNotSuccessfulException signals the AnalyseCommand to return the exit code 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change would lead to a really chaotic output in most cases which isn't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
symfony will automatically use a exit-code of 1 when a un-handled exception occurs.
no need to do this here and interrupt the exception handling
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the cause of chaotic output is that the output is scattered accross CommandHelper and the actual commands. output should be written only in a few places in the upper stack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the problem is that I don't always want to output the thrown exception with stack trace. I want to present something more friendly to the user.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when letting the exception fly through we would get a error like (no stacktrace)
no stacktrace or similar involved.
you get the stacktrace etc. only when adding
-vto the command: