@ExceptionHandler(ObjectNotFoundException.class) @ResponseStatus(value=HttpStatus.NOT_FOUND) public @ResponseBody ErrorResponse resolveDocumentNotFoundException(ObjectNotFoundException e) throws IOException {
  if (logger.isLoggable(Level.FINE))   logger.fine("space id query has no results, returning error response: " + e.getMessage());
  return new ErrorResponse(new ErrorMessage(e.getMessage()));
}

@ ExceptionHandler ( ObjectNotFoundException . class ) @ ResponseStatus ( value = HttpStatus . NOT_FOUND ) public @ ResponseBody ErrorResponse resolveDocumentNotFoundException ( ObjectNotFoundException e ) throws IOException { if ( logger . isLoggable ( Level . FINE ) ) logger . fine ( "space id query has no results, returning error response: " + e . getMessage ( ) ) ; return new ErrorResponse ( new ErrorMessage ( e . getMessage ( ) ) ) ; }
objectnotfoundexception handler , returns an error response to the client
