Просмотр исходного кода

暂时抛出全局异常信息

xucaiqin 2 лет назад
Родитель
Сommit
14d337322f

+ 1 - 14
sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/GlobalSystemExceptionHandler.java

@@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 
 import java.util.List;
-import java.util.Objects;
 import java.util.Set;
 
 @Slf4j
@@ -117,19 +116,7 @@ public class GlobalSystemExceptionHandler {
     @ExceptionHandler(Exception.class)
     public HttpResult defaultExceptionHandler(Exception ex) {
         log.error("系统异常", ex);
-        Throwable cause = ex.getCause();
-        int i = 5;
-        do {
-            i--;
-            if (Objects.isNull(cause)) {
-                break;
-            }
-            cause = cause.getCause();
-            if (cause instanceof BusinessException be) {
-                return HttpResult.error(be.getMsg());
-            }
-        } while (cause != null || i > 0);
-        return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, HttpStatus.GLOBAL_EXCEPTION_MESSAGE);
+        return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, ex.getMessage());
     }
 
 }