-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Add WrappedExceptionsInterface for nested exceptions #51653
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&rdq 8000 uo;, 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
Conversation
faf2883
to
4422f6b
Compare
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.
In order to reduce the cost of upgrading, I'd prefer not deprecating anything and instead add NestedExceptionsInterface::getExceptions()
This would mean removing the $recursive
argument, but I think this would be legit: flattening the exception hierarchy isn't needed for the interface to be sufficient.
WDYT?
src/Symfony/Component/Messenger/Exception/NestedExceptionsTrait.php
Outdated
Show resolved
Hide resolved
4422f6b
to
30c69c5
Compare
On the topic of nested exceptions. I'm looking for feedback on #51331 - getting the context of these exceptions. In the case of |
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.
Let's replace the "nested" vocabulary by "wrapped" everywhere.
Can you please also account for #51331 and preserve non-numeric keys (using array_merge(_recursive) should do it).
Last but not least, please also add test covering the $class argument.
src/Symfony/Component/Messenger/Exception/DelayedMessageHandlingException.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Exception/NestedExceptionsTrait.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Tests/Exception/HandlerFailedExceptionTest.php
Outdated
Show resolved
Hide resolved
74ddb36
to
fe56af8
Compare
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.
Can you please rebase? This LGTM after some minor tweaks on my side.
src/Symfony/Component/Messenger/Exception/WrappedExceptionsInterface.php
Outdated
Show resolved
Hide resolved
1a667ec
to
325164a
Compare
@nicolas-grekas Done. I also changed usages of |
Thank you @Jeroeny. |
This PR was merged into the 6.4 branch. Discussion ---------- [Messenger] Fix WrappedExceptionsTrait | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT Fixes some minor flaws introduced in #51653 Commits ------- f7242ca [Messenger] Fix WrappedExceptionsTrait
Metric & logging tools often want to measure / log individual exceptions from the messenger. There are currently two exception classes that hold a bunch of collected exceptions from different messages or handlers. It would be nice if there was a single interface to check and call upon when extracting these nested exceptions.
Example usecase: https://github.com/getsentry/sentry-symfony/pull/760/files#diff-da0fb4498178e4866e794b813999618022c327dea59f9277b86a7abf784aeafaR98