You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by GitBox <gi...@apache.org> on 2022/10/11 15:13:05 UTC

[GitHub] [incubator-streampark] 1996fanrui commented on a diff in pull request #1811: [Improve] Refactor the AlertException

1996fanrui commented on code in PR #1811:
URL: https://github.com/apache/incubator-streampark/pull/1811#discussion_r992458890


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/handler/GlobalExceptionHandler.java:
##########
@@ -56,32 +54,18 @@ public RestResponse handleException(Exception e) {
         return RestResponse.fail("internal server error: " + e.getMessage(), ResponseCode.CODE_FAIL);
     }
 
-    @ExceptionHandler(value = InternalException.class)
-    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public RestResponse handleParamsInvalidException(InternalException e) {
-        log.info("Internal server error:{}", e.getMessage());
-        return RestResponse.fail("internal server error: " + e.getMessage(), ResponseCode.CODE_FAIL);
-    }
-
     @ExceptionHandler(value = HttpRequestMethodNotSupportedException.class)
     @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
     public RestResponse handleException(HttpRequestMethodNotSupportedException e) {
         log.info("not supported request method,exception:{}", e.getMessage());
         return RestResponse.fail("not supported request method,exception:" + e.getMessage(), ResponseCode.CODE_FAIL);
     }
 
-    @ExceptionHandler(value = ApiAlertException.class)
+    @ExceptionHandler(value = AbstractApiException.class)
     @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public RestResponse handleException(ApiAlertException e) {
+    public RestResponse handleException(AbstractApiException e) {
         log.info("api exception:{}", e.getMessage());
-        return RestResponse.fail(e.getMessage(), ResponseCode.CODE_FAIL_ALERT);
-    }
-
-    @ExceptionHandler(value = ApiDetailException.class)
-    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public RestResponse handleException(ApiDetailException e) {
-        log.info("detail exception:{}", e.getMessage());
-        return RestResponse.fail("exception detail:\n" + e.getMessage(), ResponseCode.CODE_FAIL_DETAIL);
+        return RestResponse.fail("Api exception :\n" + e.getMessage(), e.getResponseCode());

Review Comment:
   Thanks for your review, updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org