update - 将本服务已知的各种业务校验异常进行日志降级

This commit is contained in:
wangli 2024-05-09 10:03:19 +08:00
parent 1796227cb4
commit 8fed1445d8

View File

@ -1,5 +1,6 @@
package cn.axzo.workflow.server.common.annotation;
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
import cn.axzo.workflow.server.common.util.DingTalkUtils;
import cn.azxo.framework.common.utils.LogUtil;
import lombok.extern.slf4j.Slf4j;
@ -37,7 +38,8 @@ public enum ReporterType {
if (downgrade) {
log.warn("ER: {}", e.getMessage());
} else {
LogUtil.error(LogUtil.ErrorType.ERROR_BUSINESS, shortString, e.getMessage(), e);
// LogUtil.error(LogUtil.ErrorType.ERROR_BUSINESS, shortString, e.getMessage(), e);
logWarn(e, shortString);
}
}
},
@ -53,7 +55,7 @@ public enum ReporterType {
if (downgrade) {
log.warn("ER: {}", e.getMessage());
} else {
LogUtil.error(LogUtil.ErrorType.ERROR_BUSINESS, shortString, e.getMessage(), e);
logWarn(e, shortString);
}
}
};
@ -68,4 +70,11 @@ public enum ReporterType {
*/
public abstract void executeAction(String profile, String title, Boolean sendDingTalk, Object[] args, String shortString, Throwable e, Boolean downgrade);
private static void logWarn(Throwable throwable, String shortString) {
if (throwable instanceof WorkflowEngineException) {
log.warn("引擎内部正常业务异常类型,日志降级: " + throwable.getMessage(), throwable);
} else {
LogUtil.error(LogUtil.ErrorType.ERROR_BUSINESS, shortString, throwable.getMessage(), throwable);
}
}
}