Procházet zdrojové kódy

全局异常返回处理

linft před 2 roky
rodič
revize
51e37711a3

+ 5 - 3
zd-common/common-core/src/main/java/com/zd/common/core/exception/GlobalExceptionHandler.java

@@ -73,10 +73,11 @@ public class GlobalExceptionHandler {
     public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) {
         String requestURI = request.getRequestURI();
         log.error("请求地址'{}',发生未知异常.", requestURI, e);
-        if (e.getCause() != null) {
+        /*if (e.getCause() != null) {
             return AjaxResult.error(e.getCause().toString());
         }
-        return AjaxResult.error(e.toString());
+        return AjaxResult.error(e.toString());*/
+        return AjaxResult.error("业务异常");
     }
 
     /**
@@ -86,7 +87,8 @@ public class GlobalExceptionHandler {
     public AjaxResult handleException(Exception e, HttpServletRequest request) {
         String requestURI = request.getRequestURI();
         log.error("请求地址'{}',发生系统异常.", requestURI, e);
-        return AjaxResult.error(e.getMessage());
+        //return AjaxResult.error(e.getMessage());
+        return AjaxResult.error("业务异常");
     }
 
     /**