REQ-2924-新建job流程实例不存在,日志降级
This commit is contained in:
parent
3da94cced2
commit
058562a5ae
@ -1,12 +1,16 @@
|
||||
package cn.axzo.workflow.core.engine.cmd;
|
||||
|
||||
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
|
||||
import org.apache.ibatis.exceptions.PersistenceException;
|
||||
import org.flowable.common.engine.api.FlowableException;
|
||||
import org.flowable.common.engine.api.FlowableOptimisticLockingException;
|
||||
import org.flowable.common.engine.impl.interceptor.Command;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 对 CommandContext 中的 WorkflowEngineException 进行日志降级
|
||||
@ -17,6 +21,8 @@ import org.slf4j.LoggerFactory;
|
||||
public class CustomCommandContext extends CommandContext {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CustomCommandContext.class);
|
||||
|
||||
private static final String[] PERSISTENCE_EXCEPTION_WARN_MESSAGE = new String[]{"act_ru_job"};
|
||||
|
||||
public CustomCommandContext(Command<?> command) {
|
||||
super(command);
|
||||
}
|
||||
@ -36,6 +42,10 @@ public class CustomCommandContext extends CommandContext {
|
||||
LOGGER.info("Error while closing command context", exception);
|
||||
} else if (exception instanceof WorkflowEngineException) {
|
||||
LOGGER.warn("Workflow error while closing command context", exception);
|
||||
} else if (exception instanceof PersistenceException &&
|
||||
StringUtils.hasText(exception.getMessage()) &&
|
||||
Arrays.stream(PERSISTENCE_EXCEPTION_WARN_MESSAGE).anyMatch(m -> exception.getMessage().contains(m))) {
|
||||
LOGGER.warn("persistence error while closing command context", exception);
|
||||
} else {
|
||||
LOGGER.error("Error while closing command context", exception);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user