فهرست منبع

业务异常无需打印错误日志,改为警告

dsx 2 سال پیش
والد
کامیت
ebfa8ecf62
1فایلهای تغییر یافته به همراه18 افزوده شده و 18 حذف شده
  1. 18 18
      src/main/java/com/fdkankan/openApi/exception/CustomExceptionHandler.java

+ 18 - 18
src/main/java/com/fdkankan/openApi/exception/CustomExceptionHandler.java

@@ -17,15 +17,15 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
 @Slf4j
 public class CustomExceptionHandler {
 
-    /**
-     * 处理未知异常
-     */
-    @ResponseBody
-    @ExceptionHandler(value = Exception.class)
-    public ResultData exceptionHandler(Exception e) throws Exception {
-        log.error("服务错误:", e);
-        return ResultData.error( 500, "系统错误");
-    }
+//    /**
+//     * 处理未知异常
+//     */
+//    @ResponseBody
+//    @ExceptionHandler(value = Exception.class)
+//    public ResultData exceptionHandler(Exception e) throws Exception {
+//        log.error("服务错误:", e);
+//        return ResultData.error( 500, "系统错误");
+//    }
     @ExceptionHandler(SaTokenException.class)
     public ResultData handlerSaTokenException(SaTokenException e) {
         if( NumberUtil.equals(e.getCode() , 11012)|| NumberUtil.equals(e.getCode() , 11011)) {
@@ -33,13 +33,13 @@ public class CustomExceptionHandler {
         }
         return ResultData.error(e.getCode(),e.getMessage());
     }
-    /**
-     * 处理业务异常
-     */
-    @ResponseBody
-    @ExceptionHandler(value = BusinessException.class)
-    public ResultData businessExceptionHandler(BusinessException e) {
-        log.warn("业务异常code:{},message:{}", e.getCode(), e.getMessage());
-        return ResultData.error(e.getCode(), e.getMessage());
-    }
+//    /**
+//     * 处理业务异常
+//     */
+//    @ResponseBody
+//    @ExceptionHandler(value = BusinessException.class)
+//    public ResultData businessExceptionHandler(BusinessException e) {
+//        log.warn("业务异常code:{},message:{}", e.getCode(), e.getMessage());
+//        return ResultData.error(e.getCode(), e.getMessage());
+//    }
 }