This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch dev-2.1.3
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev-2.1.3 by this push:
     new 3e2d32b2e [Improve] GlobalExceptionHandler minor improvements
3e2d32b2e is described below

commit 3e2d32b2e29ed412a52f894857370f878662af5d
Author: benjobs <[email protected]>
AuthorDate: Sat Mar 16 18:03:37 2024 +0800

    [Improve] GlobalExceptionHandler minor improvements
---
 .../console/base/handler/GlobalExceptionHandler.java       | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/handler/GlobalExceptionHandler.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/handler/GlobalExceptionHandler.java
index 323d45458..5862ed355 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/handler/GlobalExceptionHandler.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/handler/GlobalExceptionHandler.java
@@ -52,7 +52,6 @@ public class GlobalExceptionHandler {
   @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
   public RestResponse handleException(Exception e) {
     log.info("Internal server error:", e);
-    log.info(e.getCause().getClass().getName());
     return RestResponse.fail("internal server error: " + e.getMessage(), 
ResponseCode.CODE_FAIL);
   }
 
@@ -62,6 +61,13 @@ public class GlobalExceptionHandler {
     return RestResponse.fail("Unauthenticated", 
ResponseCode.CODE_UNAUTHORIZED);
   }
 
+  @ExceptionHandler(value = UnauthorizedException.class)
+  @ResponseStatus(HttpStatus.FORBIDDEN)
+  public RestResponse handleUnauthorizedException(Exception e) {
+    log.info("Permission denied,{}", e.getMessage());
+    return RestResponse.fail("Unauthenticated", ResponseCode.CODE_FORBIDDEN);
+  }
+
   @ExceptionHandler(value = AbstractApiException.class)
   @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
   public RestResponse handleException(AbstractApiException e) {
@@ -107,10 +113,4 @@ public class GlobalExceptionHandler {
     message = new StringBuilder(message.substring(0, message.length() - 1));
     return RestResponse.fail(message.toString(), ResponseCode.CODE_FAIL);
   }
-
-  @ExceptionHandler(value = UnauthorizedException.class)
-  @ResponseStatus(HttpStatus.FORBIDDEN)
-  public void handleUnauthorizedException(Exception e) {
-    log.info("Permission denied,{}", e.getMessage());
-  }
 }

Reply via email to