You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Description
If a controller argument is attributed with
MapQueryString
and the class contains a property, which is a backed enum, theBackedEnumNormalizer
is used to denormalize the value. If a user submits an invalid value for the enum, aValueError
is catched and anSymfony\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 HttpExceptionwith 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
The text was updated successfully, but these errors were encountered: