Closed as not planned
Description
Description
If a controller argument is attributed with MapQueryString
and the class contains a property, which is a backed enum, the BackedEnumNormalizer
is used to denormalize the value. If a user submits an invalid value for the enum, a ValueError
is catched and an Symfony\Component\Serializer\Exception\InvalidArgumentException
is rethrown.
But this exception is never catched and thus resulting in a 500 internal server error response.
I suggest catching this exception in the RequestPayloadValueResolver
and throw an HttpException
with a 422 or 400 status code (or with the validationFailedStatusCode
defined in the attribute), because this is a client error.
What do you think?
Example
No response