-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MissingKotlinParameterException
should extend MismatchedInputException
#321
Comments
This makes a lot of sense to me. It's been a few years since the code was written, but I'd like to hear from @jamesbassett, who wrote the exception, or @apatrida, who merged it as part of #32, to see if they have any thoughts. |
Sounds good to me as well. |
Draft PR: #325 |
Yeah seems good to me - as it's a subclass it shouldn't introduce any real backwards compatibility issues. At work, we have a Spring controller advice that handles |
@dinomite Only one suggestion: it might make sense to rebase to 2.11 branch as I am also finally giving access to @dinomite and @viartemev and so I think we have more committers who can do merge. |
👍 I'll get it based onto 2.11, makes more sense there |
MissingKotlinParameterException
should extend MismatchedInputException
Should
MissingKotlinParameterException
extendMismatchedInputException
?The javadoc of
MismatchedInputException
suggests thatMissingKotlinParameterException
is a valid subtype:In a recent version of Spring, a change was introduced that differentiate handling of exceptions when parsing a HTTP input:
https://github.com/spring-projects/spring-framework/blob/b889700548681382911e06701b257549bb81e929/spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java#L242
Basically, if Jackson throws MismatchedInputException our controllers respond with 400 Bad Request, otherwise they respond with 500 Internal Server Error.
Because of this change, Kotlin dtos cannot be properly rejected when a non-nullable constructor argument is missing.
An example problem it causes:
spring-projects/spring-framework#24610
The text was updated successfully, but these errors were encountered: