update - 将异步任务内正常异常进行吞并, 但仍然记录异常信息

This commit is contained in:
wangli 2024-07-01 15:39:01 +08:00
parent 018c4bb9eb
commit 284ac47e7d

View File

@ -19,15 +19,16 @@ public class CustomWorkflowEngineExceptionHandler implements AsyncRunnableExecut
@Override
public boolean handleException(JobServiceConfiguration jobServiceConfiguration, JobInfo job, Throwable e) {
Throwable rootCause = getRootCause(e);
if (rootCause.getClass().isAssignableFrom(WorkflowEngineException.class)) {
WorkflowEngineException workflowEngineException = (WorkflowEngineException) rootCause;
if (Objects.equals(workflowEngineException.getCode(), "99806020")) {
log.info("AsyncApproveTaskJobHandler execute exception code: {} info: {}",
workflowEngineException.getCode(), rootCause.getMessage(), rootCause);
return true;
}
}
return false;
// if (rootCause.getClass().isAssignableFrom(WorkflowEngineException.class)) {
// WorkflowEngineException workflowEngineException = (WorkflowEngineException) rootCause;
// if (Objects.equals(workflowEngineException.getCode(), "99806020")) {
// log.info("AsyncApproveTaskJobHandler execute exception code: {} info: {}",
// workflowEngineException.getCode(), rootCause.getMessage(), rootCause);
// return true;
// }
// }
log.warn("Async Runnable Execution Exception: {}", rootCause.getMessage(), e);
return WorkflowEngineException.class.isAssignableFrom(rootCause.getClass());
}
private Throwable getRootCause(Throwable throwable) {