Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DATAREST-1143 - throw a ResourceNotFoundException instead of returning an http response with status code directly #284

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
jreijn wants to merge 2 commits into spring-projects:master from jreijn:DATAREST-1143

Conversation

@jreijn
Copy link
Contributor

@jreijn jreijn commented Nov 14, 2017
edited
Loading

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.
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
Copy link
Contributor Author

jreijn commented Feb 19, 2018

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

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.

Copy link

@odrotbohm Any thoughts on this?

Copy link
Member

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

pkostrzewa and jreijn reacted with hooray emoji

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.
Copy link
Member

In place now.

jreijn and pkostrzewa reacted with hooray emoji

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /