-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Add UnwrapHandlerExceptionMiddleware
#52949
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
Conversation
Hey! Thanks for your PR. You are targeting branch "7.1" but it seems your PR description refers to branch "7.1 for features". Cheers! Carsonbot |
7b50f67
to
7514be6
Compare
why not unwrap from within HandleTrait then? edit: oh BC -.-, perhaps introduce a new property flag instead 🤔 |
3d72517
to
99e8e2b
Compare
Will give it a try thanks! The property would only serve as a BC layer so I’m not sure if https://symfony.com/doc/current/contributing/code/bc.html#adding-an-argument-to-a-public-method would apply? |
adding new private property to traits is allowed :) it not sure why it would 'serve as a BC layer', it could be just a new feature if we think it's the better default, then perhaps deprecating I dont like the middleware approach, since it might force users to split their bus into multiple buses. IMHO it breaks the abstraction of |
Oh indeed I thought you were talking about a new argument for
AFAIU we first need a way to make the new behavior opt-in (to keep BC), but then remove the old one. The opt-in mechanism would then only serve as a BC layer.
Don’t know about that, but |
src/Symfony/Component/Messenger/Middleware/UnwrapHandlerExceptionMiddleware.php
Outdated
Show resolved
Hide resolved
@OskarStark @chalasr FYI I also opened #52952 which is an alternative proposed by @ro0NL I find better. Do you have a preference? |
…ionMiddleware.php Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
8bcea67
to
f59c844
Compare
Closing, since there is no traction and a solution is trivial to implement in userland. |
In competition with #52952
When using the
HandleTrait
, theHandlerFailedException
just adds noise as the wrapped exception is the one we would expect to be thrown.This PR adds an
UnwrapHandlerExceptionMiddleware
(idea stolen from Sulu’sUnpackExceptionMiddleware
): added to a bus before theHandleMessageMiddleware
, it will throw the single exception wrapped in aHandlerFailedException
.