Jeroen Reijn opened DATAREST-1143 and commented
We're building a REST API based on spring-data-rest and we're trying to implement custom error response messages.
We have our own CustomRestExceptionHandler and this seems to work all fine for almost all cases except for getting an item by ID. When fetching a non-existing entity, a 404 status is returned without a message body and no catchable exception is thrown.
I noticed that RepositoryEntityController#getItemResource directly returns a new ResponseEntity<Resource<?>>(HttpStatus.NOT_FOUND) instead of throwing a ResourceNotFoundException like for instance the RepositoryEntityController#headForItemResource does. It would like to suggest that getItemResource returns a ResourceNotFoundException so it can be caught and/or generates an error response message
Affects: 2.6.7 (Ingalls SR7), 3.0 GA (Kay)
Referenced from: pull request #284, and commits 6d0acfd