Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Catch \Throwable#18765
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Catch \Throwable#18765
Uh oh!
There was an error while loading.Please reload this page.
Conversation
stof commentedMay 12, 2016
some of these changes should actually be done in 2.3 or in 2.7 too. Can you open 3 PRs instead ?
|
fprochazka commentedMay 12, 2016
I wasn't aware the 2.3 is still maintained :) I'll do that then. |
fprochazka commentedMay 12, 2016
@stof I think it would be more productive to have 90% of the discussion under one PR and I can split it after this is cleaned, so I'm not doing it over 4 branches. |
eeae733 to0fd9ef3Compare| namespace Symfony\Component\Console\Exception; | ||
| class FatalThrowableError extends \ErrorException |
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, and the other one inSecurity/Http are copied fromSymfony\Component\Debug\Exception\FatalErrorException, since there is no direct dependency.
| }catch (\Exception$e) { | ||
| // unable to optimize unknown notation | ||
| }catch (\Throwable$e) { | ||
| // unable to optimize unknown notation |
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.
-1 for this one. Getting an Error in the parser should not happen when it is an unknown notation (the parser is expected to throw an Exception in such case), so it would only hide bugs
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.
Makes sense, having it more specific and only throw away something, not everything seems more sane 👍
| $e->getCode(), | ||
| $severity, | ||
| $e->getFile(), | ||
| $e->getLine() |
fprochazkaMay 13, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
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.
Btw, why is theThrowable not added as previous inSymfony\Component\Debug\Exception\FatalThrowableError ? It doesn't feel right to throw it away completely.
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.
The original is not thrown away: the state of the new FatalThrowableError has all bits from the original Error exception. Adding it as previous would defeat the purpose of FatalThrowableError, which is to pass the \Exception type hints (even for exceptions in the previous chain).
nicolas-grekas commentedMay 13, 2016
I'm mostly 👎 but on a few spots: \Error should not be dealt with as regular exceptions. They are a sign of serious issues and recovering after them is encouraging not fixing the related issues to me. |
stof commentedMay 13, 2016
yeah, catching them is fine in places where they are rethrown after some cleanup (use case for |
| }catch (\Exception$e) { | ||
| $exitCode =1; | ||
| $rows[] =array(sprintf('<fg=red;options=bold>%s</>','\\' ===DIRECTORY_SEPARATOR ?'ERROR' :"\xE2\x9C\x98"/* HEAVY BALLOT X (U+2718) */),$message,$e->getMessage()); | ||
| }catch (\Throwable$e) { |
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.
should be removed
| // the response that comes back is simply ignored | ||
| if (isset($options['ignore_errors']) &&$options['ignore_errors'] &&$this->dispatcher) { | ||
| $event =newGetResponseForExceptionEvent($this->kernel,$request, HttpKernelInterface::SUB_REQUEST,$e); | ||
| }catch (\Throwable$e) { |
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.
should be reverted OR discussed in a dedicated PR
nicolas-grekas commentedMay 15, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@fprochazka thanks for this PR. I added a comment everywhere I think catching |
| // Using user_error() here is on purpose so we do not forget | ||
| // that this alias also should work alongside with trigger_error(). | ||
| returnuser_error($e,E_USER_ERROR); |
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.
So... should I still create a testcase for this with new fixture for throwable?
fprochazka commentedMay 16, 2016
@nicolas-grekas I've removed those where I agree, but I would like a better reasoning behind those I left untouched, that you've commented. They seem important to me. |
1b61b94 to76f5f90Comparefprochazka commentedMay 19, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
All the comments are solved, so I'm gonna start spliting this to more branchesas @stof said |
38b4d5c tode671f4Comparefprochazka commentedMay 19, 2016
Should I try to help with PR for 3.0? Or will the mergers solve the possible conflicts and throw away changes that are not relevant in 3.0? As I'm sure there will be some. |
nicolas-grekas commentedMay 20, 2016
👍 |
xabbuh commentedMay 23, 2016
👍 |
This PR was merged into the 2.7 branch.Discussion----------Catch \Throwable| Q | A| ------------- | ---| Branch? | 2.7, 2.8, 3.0| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | Yes| Fixed tickets | n/a| License | MIT| Doc PR | n/aRelated#18765,#15949Depends on#18812Commits-------103526b Catch \Throwable
fabpot commentedMay 23, 2016
Thank you@fprochazka. |
This PR was merged into the 2.8 branch.Discussion----------Catch \Throwable| Q | A| ------------- | ---| Branch? | 2.8, 3.0| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | Mostly!| Fixed tickets | n/a| License | MIT| Doc PR | n/aThe first commit is based on#15949Depends on#18813,#18812----I'm new to symfony, so I'm not sure where are all the places where it makes sense to actually catch the throwable and where not. I added most places that seemed logical and when I wasn't sure, I added it anyway. I'm hoping you guys (and girls?) can point out the places where the catch should not be added, I'll fix it and then I can create several PR's for the older branches. A lot of this IMHO should go also to 3.0.Commits-------de671f4 Catch \Throwable
This PR was squashed before being merged into the 2.3 branch (closes#18812).Discussion----------Catch \Throwable| Q | A| ------------- | ---| Branch? | 2.3, 2.7, 2.8, 3.0| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | Yes| Fixed tickets | n/a| License | MIT| Doc PR | n/aRelated#18765,#15949Commits-------893cf00 Catch \Throwable
Uh oh!
There was an error while loading.Please reload this page.
The first commit is based on#15949
Depends on#18813,#18812
I'm new to symfony, so I'm not sure where are all the places where it makes sense to actually catch the throwable and where not. I added most places that seemed logical and when I wasn't sure, I added it anyway. I'm hoping you guys (and girls?) can point out the places where the catch should not be added, I'll fix it and then I can create several PR's for the older branches. A lot of this IMHO should go also to 3.0.