-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
[Notifier] Allow passing a previous throwable to exceptions #42183
Conversation
Signed-off-by: Alexander M. Turek <me@derrabus.de>
You beat me with a minute =) |
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.
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) |
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.
Do you have a use case where this is needed?
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.
Forbidding to chain exceptions is really a bad anti-pattern. I would simply always allow it.
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.
Fair.
I just dont know of a situation where you would like to chain a UnsupportedSchemeException
.
Good catch, thanks Alexander. |
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.