Skip to content

symfony/messenger v4.3 wraps any exception into HandlerFailedException #2856

Description

@karser

Hi folks!

Before symfony/messenger v4.3, the exceptions were transparent - you got what you threw. So that you could specify them in the exception_to_status map and receive meaningful statuses.
As of v4.3, symfony/messenger started wrapping any exception into HandlerFailedException, so api-platform always returns 500.
Here is a similar issue described in SO https://stackoverflow.com/questions/55558350/custom-exception-from-messenger-handler

So the idea is to recover previous exception and match to exception_to_status map.

if ($exception instanceof HandlerFailedException) {
    $exception = $exception->getPrevious();
}

What do you think of this approach? Does it make sense or I'm missing something?

Metadata

Metadata

Assignees

Labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions