-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
WebDataBinder type conversion failures should result in 400, not 500 [SPR-5622] #10293
Comments
Grzegorz Borkowski commented The response code should be definitively 400. |
Arjen Poutsma commented We're going to have a DefaultHandlerExceptionResolver that is loaded by default (hence the name ;) ) and sets the status code to something in the 4xx range for all common Spring exceptions. See #10295. Additionally, we're going to allow for controller methods to be annotated with an annotation (something like Finally, we're going to allow you to annotate your own exceptions with I think these three options will give you enough possibilities of handling exceptions, while having sensible defaults. |
Grzegorz Borkowski commented This sounds really good to me (and I'm really impressed by so short implementation time! thanks) |
Grzegorz Borkowski commented There is one problem with current implementation (3.0 M3), not sure if it's related to this issue or should I create another one. |
Arjen Poutsma commented I think that it's best if we change the javadoc. In some cases, you might not want to have the defaults, and by adding them, we would make it impossible to replace them. |
Arjen Poutsma commented Reopening to change the javadoc. |
Arjen Poutsma commented Improved javadoc. |
Arjen Poutsma opened SPR-5622 and commented
When data cannot be bound by a WebDataBinder, this results in a TypeMismatchException, and eventually a status code 500: internal server error. This should be a 400: Bad Request
Issue Links:
Referenced from: commits 880eb9e
The text was updated successfully, but these errors were encountered: