The Wayback Machine - https://web.archive.org/web/20221107011127/https://github.com/symfony/symfony/pull/42183
Skip to content
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

[Notifier] Allow passing a previous throwable to exceptions #42183

Merged

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Jul 19, 2021

Q A
Branch? 5.2
Bug fix? yes
New feature? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

It should always be possible to pass a a previous throwable to a new exception. This PR streamlines the constructors of the Notifier component's exception classes.

Signed-off-by: Alexander M. Turek <me@derrabus.de>
@Nyholm
Copy link
Member

Nyholm commented Jul 19, 2021

You beat me with a minute =)

Copy link
Member

@Nyholm Nyholm left a comment

I agree to add this as a bugfix. It does not break BC: https://3v4l.org/bqFsI

@@ -91,7 +91,7 @@ class UnsupportedSchemeException extends LogicException
/**
* @param string[] $supported
*/
public function __construct(Dsn $dsn, string $name = null, array $supported = [])
public function __construct(Dsn $dsn, string $name = null, array $supported = [], \Throwable $previous = null)
Copy link
Member

@Nyholm Nyholm Jul 19, 2021

Choose a reason for hiding this comment

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

Do you have a use case where this is needed?

Copy link
Member Author

@derrabus derrabus Jul 19, 2021

Choose a reason for hiding this comment

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

Forbidding to chain exceptions is really a bad anti-pattern. I would simply always allow it.

Copy link
Member

@Nyholm Nyholm Jul 19, 2021

Choose a reason for hiding this comment

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

Fair.

I just dont know of a situation where you would like to chain a UnsupportedSchemeException.

@OskarStark
Copy link
Contributor

OskarStark commented Jul 19, 2021

Good catch, thanks Alexander.

@OskarStark OskarStark merged commit 24ec4e0 into symfony:5.2 Jul 19, 2021
10 checks passed
@derrabus derrabus deleted the bugfix/notifier-exception-constructors branch Jul 19, 2021
This was referenced Jul 26, 2021
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.

None yet

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