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

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

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

Merged

Conversation

derrabus
Copy link
Member

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

Choose a reason for hiding this comment

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

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

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

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

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

Good catch, thanks Alexander.

@OskarStark OskarStark merged commit 24ec4e0 into symfony:5.2 Jul 19, 2021
@derrabus derrabus deleted the bugfix/notifier-exception-constructors branch July 19, 2021 07:09
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.

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