Skip to content

Conversation

@jreijn
Copy link
Contributor

@jreijn jreijn commented Nov 14, 2017

Changed getItemResource to throw a ResourceNotFoundException instead of returning an empty ResponseEntity with a status code when an item can't be found. This will allow projects to use a ResponseEntityExceptionHandler and create a custom error message for 404 responses on GET requests, which is not possible at the moment.

  • You have read the Spring Data contribution guidelines.
  • There is a ticket in the bug tracker for the project in our JIRA.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

…g the http response directly.

Changed to a ResourceNotFoundException is thrown, so it allows for custom error handling.
@jreijn
Copy link
Contributor Author

jreijn commented Nov 14, 2017

As this is my first contribution to spring-data all feedback is welcome.

@jreijn jreijn changed the title DATAREST-1143 - throw a ResourceNotFoundException with a GET DATAREST-1143 - throw a ResourceNotFoundException instead of returning an http response with status code directory Nov 17, 2017
@jreijn jreijn changed the title DATAREST-1143 - throw a ResourceNotFoundException instead of returning an http response with status code directory DATAREST-1143 - throw a ResourceNotFoundException instead of returning an http response with status code directly Nov 17, 2017
@jreijn
Copy link
Contributor Author

jreijn commented Feb 19, 2018

Is there anything I need to do to move this forward?

@jamarciano
Copy link

Is there anything preventing this from being merged going forward?

It would be very nice to be able to handle these exceptions normally; the alternatives aren't very intuitive and don't work quite as well as this would.

@pkostrzewa
Copy link

@odrotbohm Any thoughts on this?

@odrotbohm
Copy link
Member

Sorry, this took so long. I'll schedule this for inclusion into Moore M2 (Spring Data REST 3.2).

odrotbohm pushed a commit that referenced this pull request Mar 5, 2019
…notFound().

This is to allow users to plug in custom exception handling to control these situations.

Original pull request: #284.
@odrotbohm
Copy link
Member

In place now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants