Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Debug] Keep previous errors of Error instances #26338

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 1 commit into from

Conversation

Philipp91
Copy link
Contributor

Q A
Branch? 2.7 (I have tested against 4.0, but I guess it applies to all the older versions too)
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? ?
Fixed tickets --
License MIT

Passing on the previous exception gives developers better debugging information. In particular, if you throw an uncaught new \Error("Something", 0, new \Exception("Inner exception")) or sth. like that today, you will not see the "Inner exception" text (which may be more helpful than the outer error) in the HTTP debug response. Converting exceptions into errors this way is a common pattern when an exception raised in a sub-routine cannot reasonably occur for a specific caller situation, so there it becomes an AssertionError instead.

@Philipp91 Philipp91 changed the base branch from 2.7 to master February 27, 2018 21:56
@Philipp91
Copy link
Contributor Author

Seems like GitHub won't easily let me propose this for the 2.7 branch, but it should be mergeable there without conflicts.

@GromNaN
Copy link
Member

GromNaN commented Feb 28, 2018

This PR needs a descriptive title.

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Feb 28, 2018
@nicolas-grekas nicolas-grekas changed the title Patch 1 [Debug] Keep previous errors of Error instances Feb 28, 2018
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

OK for 2.7

@Philipp91
Copy link
Contributor Author

Sorry about the PR title. The CI failure on one of three PHP versions seems unrelated, I don't think my change causes a segmentation fault.

@fabpot
Copy link
Member

fabpot commented Feb 28, 2018

Thank you @Philipp91.

@fabpot fabpot closed this Feb 28, 2018
fabpot added a commit that referenced this pull request Feb 28, 2018
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #26338).

Discussion
----------

[Debug] Keep previous errors of Error instances

| Q             | A
| ------------- | ---
| Branch?       | 2.7 (I have tested against 4.0, but I guess it applies to all the older versions too)
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | ?
| Fixed tickets | --
| License       | MIT

Passing on the previous exception gives developers better debugging information. In particular, if you throw an uncaught `new \Error("Something", 0, new \Exception("Inner exception"))` or sth. like that today, you will not see the "Inner exception" text (which may be more helpful than the outer error) in the HTTP debug response. Converting exceptions into errors this way is a common pattern when an exception raised in a sub-routine cannot reasonably occur for a specific caller situation, so there it becomes an `AssertionError` instead.

Commits
-------

b1b6093 Pass on previous exception in FatalThrowableError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.