From eefe3a9c6eba2c979cb2fdd57e819364018e843a Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期五, 28 一月 2022 19:56:30 +0800
Subject: [PATCH] update 更新全局异常响应

---
 ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
index bc58049..19673c5 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
@@ -8,7 +8,6 @@
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.exception.DemoModeException;
 import com.ruoyi.common.exception.ServiceException;
-import com.ruoyi.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.support.DefaultMessageSourceResolvable;
 import org.springframework.validation.BindException;
@@ -32,33 +31,33 @@
 public class GlobalExceptionHandler {
 
     /**
-     * 鏉冮檺鏍¢獙寮傚父
+     * 鏉冮檺鐮佸紓甯�
      */
     @ExceptionHandler(NotPermissionException.class)
-    public AjaxResult<Void> handleAccessDeniedException(NotPermissionException e, HttpServletRequest request) {
+    public AjaxResult handleNotPermissionException(NotPermissionException e, HttpServletRequest request) {
         String requestURI = request.getRequestURI();
-        log.error("璇锋眰鍦板潃'{}',鏉冮檺鏍¢獙澶辫触'{}'", requestURI, e.getMessage());
-        return AjaxResult.error(HttpStatus.HTTP_FORBIDDEN, "娌℃湁鏉冮檺锛岃鑱旂郴绠$悊鍛樻巿鏉�");
+        log.error("璇锋眰鍦板潃'{}',鏉冮檺鐮佹牎楠屽け璐�'{}'", requestURI, e.getMessage());
+        return AjaxResult.error(HttpStatus.HTTP_FORBIDDEN, "娌℃湁璁块棶鏉冮檺锛岃鑱旂郴绠$悊鍛樻巿鏉�");
     }
 
     /**
-     * 瑙掕壊鏍¢獙寮傚父
+     * 瑙掕壊鏉冮檺寮傚父
      */
     @ExceptionHandler(NotRoleException.class)
-    public AjaxResult<Void> handleAccessDeniedException(NotRoleException e, HttpServletRequest request) {
+    public AjaxResult handleNotRoleException(NotRoleException e, HttpServletRequest request) {
         String requestURI = request.getRequestURI();
-        log.error("璇锋眰鍦板潃'{}',瑙掕壊鏍¢獙澶辫触'{}'", requestURI, e.getMessage());
-        return AjaxResult.error(HttpStatus.HTTP_FORBIDDEN, "娌℃湁瑙掕壊锛岃鑱旂郴绠$悊鍛樻巿鏉�");
+        log.error("璇锋眰鍦板潃'{}',瑙掕壊鏉冮檺鏍¢獙澶辫触'{}'", requestURI, e.getMessage());
+        return AjaxResult.error(HttpStatus.HTTP_FORBIDDEN, "娌℃湁璁块棶鏉冮檺锛岃鑱旂郴绠$悊鍛樻巿鏉�");
     }
 
     /**
      * 璁よ瘉澶辫触
      */
     @ExceptionHandler(NotLoginException.class)
-    public AjaxResult<Void> handleAccessDeniedException(NotLoginException e, HttpServletRequest request) {
+    public AjaxResult handleNotLoginException(NotLoginException e, HttpServletRequest request) {
         String requestURI = request.getRequestURI();
         log.error("璇锋眰鍦板潃'{}',璁よ瘉澶辫触'{}',鏃犳硶璁块棶绯荤粺璧勬簮", requestURI, e.getMessage());
-        return AjaxResult.error(HttpStatus.HTTP_UNAUTHORIZED, StringUtils.format("璇锋眰鍦板潃'{}',璁よ瘉澶辫触'{}',鏃犳硶璁块棶绯荤粺璧勬簮", requestURI));
+        return AjaxResult.error(HttpStatus.HTTP_UNAUTHORIZED, "璁よ瘉澶辫触锛屾棤娉曡闂郴缁熻祫婧�");
     }
 
     /**

--
Gitblit v1.9.3