Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0678465
Add RestController in Core with version method
yeejian-tan Jul 14, 2020
4535673
Add exception handlers for missing URL parameters
yeejian-tan Jul 17, 2020
8f01415
Mark variables as optional
yeejian-tan Jul 17, 2020
489c9ae
Make format-java
yeejian-tan Jul 17, 2020
6d19fe6
Make feature_set_id non-required per gRPC
yeejian-tan Jul 20, 2020
bddf539
Add Unit Tests for Core REST Controller
yeejian-tan Jul 20, 2020
1f7f1d9
Add javadoc, remove json printer
yeejian-tan Jul 22, 2020
7f73645
Fix Javadocs Errors and typo
yeejian-tan Jul 22, 2020
d77a2ca
Modify Unit tests to not rely on Mockmvc
yeejian-tan Jul 22, 2020
762b6ef
Add Integration Tests for CoreServiceRestController
yeejian-tan Jul 22, 2020
4ab312c
Remove labels as it is not yet fully tested
yeejian-tan Jul 23, 2020
ef99493
Remove getFeatureSet REST endpoint
yeejian-tan Jul 23, 2020
9dc772b
Add integration tests for REST controller
yeejian-tan Jul 23, 2020
901dbe8
Remove default query params for grpc consistency
yeejian-tan Jul 23, 2020
8e23674
Remove Unit Tests
yeejian-tan Jul 23, 2020
1c9efd4
Keep get feature-statistics consistent with grpc
yeejian-tan Jul 29, 2020
f5bae5d
Add comments on exception handlers for core http
yeejian-tan Jul 29, 2020
2169c0a
Use WebTestClient for core HTTP ITs
yeejian-tan Jul 29, 2020
f545a2c
Use reactor-test and remove autowired params
yeejian-tan Jul 29, 2020
7ce74e0
Use RestAssured for REST IT
yeejian-tan Aug 3, 2020
1ba9a40
Replace ProjectService w/ AccessManagementService
yeejian-tan Aug 3, 2020
9dab69f
Handle retrieval errors caused by getFeatureStats
yeejian-tan Aug 5, 2020
6e8c8df
Add disableRestControllerAuth flag
yeejian-tan Aug 7, 2020
4156a4f
Add documentation comment on application.yml
yeejian-tan Aug 11, 2020
8017f9a
Fix integration test
terryyylim Aug 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Handle retrieval errors caused by getFeatureStats
  • Loading branch information
yeejian-tan authored and Terence committed Aug 17, 2020
commit 9dab69fda6d2dc784acf4bf42ad917b3f8fab75b
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,29 @@ protected ResponseEntity<Object> handleInvalidProtocolBuffer(
ex, bodyOfResponse, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
}

/**
* Handles the case that retrieval of information from the services triggered and exception.
* Instead of returning 500 with no error message, returns 500 with a body describing the error
* message.
*
* @param ex the {@link RetrievalException} that occurred.
* @param request the {@link WebRequest} that caused this exception.
* @return (500 Internal Server Error)
*/
@ExceptionHandler({RetrievalException.class})
protected ResponseEntity<Object> handleRetrieval(RetrievalException ex, WebRequest request) {
Map<String, String> bodyOfResponse = Map.of("error", ex.getMessage());
return handleExceptionInternal(
ex, bodyOfResponse, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
}

/**
* Handles various exceptions that are due to malformed or invalid requests, such as
*
* <ul>
* <li>{@link UnsatisfiedServletRequestParameterException} where a parameter is requested in
* {@link org.springframework.web.bind.annotation.RequestMapping} but not supplied.
* <li>{@link IllegalArgumentException} where unsupported parameters are provided.
* <li>{@link RetrievalException} where a store specified is not
* </ul>
*
* @param ex the {@link UnsatisfiedServletRequestParameterException} that occurred.
Expand All @@ -67,8 +82,7 @@ protected ResponseEntity<Object> handleInvalidProtocolBuffer(
*/
@ExceptionHandler({
UnsatisfiedServletRequestParameterException.class,
IllegalArgumentException.class,
RetrievalException.class
IllegalArgumentException.class
})
protected ResponseEntity<Object> handleBadRequest(Exception ex, WebRequest request) {
ex.printStackTrace();
Expand Down