dropwizard icon indicating copy to clipboard operation
dropwizard copied to clipboard

FuzzyEnumParamConverter does not allow some error responses to be remapped using exception mappers

Open tmelmoth opened this issue 2 years ago • 0 comments

If FuzzyEnumParamConverter calls the fromStringMethod but is unable to convert the string to an enum value, it will throw a WebApplicationException constructed using a Response parameter instead of constructed using a String message. This will cause Jersey to return the Response as-is, bypassing any exception mappers that may be set up. This prevents exception mappers from being used to return error messages in a consistent format if an invalid enum value is provided as a path parameter. FuzzyEnumParamConverter should construct the WebApplicationException using a String message parameter instead of a Response so that it can be remapped into a response by the exception mappers.

I'm planning on submitting a PR to fix this issue.

tmelmoth avatar Jun 03 '22 17:06 tmelmoth