8000 FlattenException does not work with Throwable · Issue #26429 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

FlattenException does not work with Throwable #26429

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
instabledesign opened this issue Mar 6, 2018 · 4 comments
Closed

FlattenException does not work with Throwable #26429

instabledesign opened this issue Mar 6, 2018 · 4 comments

Comments

@instabledesign
Copy link
Contributor
instabledesign commented Mar 6, 2018
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? yes
Symfony/Debug >=4.0.0

The class FlattenException doesn't work with Throwable

Symfony\Component\Debug\Exception\FlattenException::create(new TypeError('Bad type error.'));
TypeError: Argument 1 passed to Symfony\Component\Debug\Exception\FlattenException::create() must be an instance of Exception, instance of TypeError given, called in /var/www/index.php on line 5 in /var/www/vendor/symfony/symfony/src/Symfony/Component/Debug/Exception/FlattenException.php on line 36
@stof
Copy link
Member
stof commented Mar 6, 2018

The Debug component is wrapping Error in FatalThrowableError. FlattenException::create was never documented as accepting Error objects directly.

@instabledesign
< 8000 /span> Copy link
Contributor Author
instabledesign commented Mar 6, 2018

Yes but it costs nothing to do. Does it?

@ostrolucky
Copy link
Contributor
ostrolucky commented Mar 7, 2018

Name would be wrong then, wouldn't it? It's called flattenexception, not flattenerror.

@instabledesign
Copy link
Contributor Author

You right. We must rename into FlattenThrowable instead.

@fabpot fabpot closed this as completed Apr 6, 2018
fabpot added a commit that referenced this issue Apr 6, 2018
…on (derrabus)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[Debug] Support any Throwable object in FlattenException

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #26429
| License       | MIT
| Doc PR        | N/A

Alternative to #26447 without BC breaks, follows #26028.

This PR removes the need to convert `Throwable` objects into exceptions when working with `FlattenException`.

ping @instabledesign @ostrolucky @nicolas-grekas

Commits
-------

96c1a6f Support any Throwable object in FlattenException.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0