Skip to content

Send BindingResult Errors in ResponseEntityExceptionHandler [SPR-13183] #17775

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

Closed
spring-projects-issues opened this issue Jul 1, 2015 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 1, 2015

Chris Bonham opened SPR-13183 and commented

I propose adding the BindingResult errors in the entity response for these ResponseEntityExceptionHandler methods:

  • handleBindException()
  • handleMethodArgumentNotValid()

This will give the RESTful API caller more information when a 400 status is received.


Affects: 4.2 RC2

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Chris Bonham commented

I have created pull request #831 for this enhancement.

I have also signed the SpringSource CLA.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jul 6, 2015

Rossen Stoyanchev commented

What you've proposed is one option for what goes in the body of an error response but there can be many others. For most REST APIs we expect some kind of JSON error response along the lines of what's discussed in #17136. This is why ResponseEntityExceptionHandler is an abstract base class. The idea is that your sub-class will decide what goes in the body. In short your PR is a perfectly valid choice for an application. It's just not something we want to do by default for all applications.

@spring-projects-issues spring-projects-issues added status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants