diff --git a/commons/web-common/src/main/java/com/schbrain/common/web/exception/DefaultGlobalExceptionHandler.java b/commons/web-common/src/main/java/com/schbrain/common/web/exception/DefaultGlobalExceptionHandler.java index 529db43023369d0ee38f82736d70b00d85c1a25e..7fe112104449865692183d4f6ab9dbbc521e1167 100644 --- a/commons/web-common/src/main/java/com/schbrain/common/web/exception/DefaultGlobalExceptionHandler.java +++ b/commons/web-common/src/main/java/com/schbrain/common/web/exception/DefaultGlobalExceptionHandler.java @@ -2,7 +2,6 @@ package com.schbrain.common.web.exception; import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.util.StrUtil; -import com.schbrain.common.constants.ResponseActionConstants; import com.schbrain.common.exception.BaseException; import com.schbrain.common.util.EnvUtils; import com.schbrain.common.web.result.ResponseDTO; @@ -41,8 +40,8 @@ public class DefaultGlobalExceptionHandler implements GlobalExceptionHandler { /************************************* Base Exception Handing *************************************/ @ExceptionHandler(BaseException.class) public ResponseDTO handleBaseException(BaseException ex) { - log.error(ex.getMessage()); - return buildResponse(ex, ex.getCode(), ex.getAction(), ex.getMessage()); + logError(ex); + return ResponseDTO.error(ex); } /************************************* Common Exception Handing *************************************/ @@ -200,19 +199,15 @@ public class DefaultGlobalExceptionHandler implements GlobalExceptionHandler { } protected ResponseDTO buildResponse(Throwable throwable, int code, String message) { - return buildResponse(throwable, code, ResponseActionConstants.ALERT, message); - } - - protected ResponseDTO buildResponse(Throwable throwable, int code, int action, String message) { boolean isProduction = EnvUtils.isProduction(); ResponseDTO responseDTO = getExceptionResponseMapping(throwable, isProduction); if (responseDTO != null) { return responseDTO; } if (isProduction || StringUtils.isBlank(message)) { - return ResponseDTO.error("系统错误", code, action); + return ResponseDTO.error("系统错误", code); } - return ResponseDTO.error(message, code, action); + return ResponseDTO.error(message, code); } protected ResponseDTO getExceptionResponseMapping(Throwable throwable, boolean isProduction) { diff --git a/pom.xml b/pom.xml index fee277c3dc0775e080a110151af265e3c852626d..ca3ce1f7899115a3a6c15c7b286d66fa517b818a 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ - 3.0.2-SNAPSHOT + 3.0.3 11 ${revision}