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
Observed with Spring v5.2.4. Whenever a request body cannot be deserialized by failing with a JsonMappingException, the MessageNotReadableAdviceTrait does not get invoked.
Description
I noticed this in a kotlin project, where a MissingKotlinParameterException was thrown. This exception should, in general, map to a 400 Bad Request with a problem description.
Expected Behavior
A 400 Bad Request in the aforementioned case.
Actual Behavior
In my case, a 500 Server Error was returned (generic fallback).
Possible Fix
I noticed that MessageNotReadableAdviceTrait relies on a HttpMessageNotReadableException being thrown. With spring-projects/spring-framework@b889700 Spring throws a HttpMessageConversionException instead. One might fix this problem here by introducing another AdviceTrait handling such exceptions. Not sure however, if one should reach out to spring team instead.
Steps to Reproduce
Maybe later, limited on time :(
Context
See above.
Your Environment
Version used: 0.25.2
The text was updated successfully, but these errors were encountered:
Observed with Spring v5.2.4. Whenever a request body cannot be deserialized by failing with a JsonMappingException, the MessageNotReadableAdviceTrait does not get invoked.
Description
I noticed this in a kotlin project, where a MissingKotlinParameterException was thrown. This exception should, in general, map to a 400 Bad Request with a problem description.
Expected Behavior
A 400 Bad Request in the aforementioned case.
Actual Behavior
In my case, a 500 Server Error was returned (generic fallback).
Possible Fix
I noticed that MessageNotReadableAdviceTrait relies on a HttpMessageNotReadableException being thrown. With spring-projects/spring-framework@b889700 Spring throws a HttpMessageConversionException instead. One might fix this problem here by introducing another AdviceTrait handling such exceptions. Not sure however, if one should reach out to spring team instead.
Steps to Reproduce
Maybe later, limited on time :(
Context
See above.
Your Environment
The text was updated successfully, but these errors were encountered: