Skip to content

[Messenger] Make HandleTrait unwrap HandlerFailedException #52300

@MatTheCat

Description

@MatTheCat

Description

The HandleTrait allows to use Messenger as a function call by enforcing a single handler being called and returning its result (cf. https://symfony.com/doc/current/messenger.html#getting-results-when-working-with-command-query-buses).

Still, if this handler throws an exception it will be wrapped in a HandlerFailedException. The latter is useful when multiple handlers are called, but it seems to me it just adds noise when using the HandleTrait.

Would it make sense to make HandleTrait::handle catch HandlerFailedExceptions and throw the wrapped exception instead?

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions