瀏覽代碼

bug #I4TBDT 修复因为ChianEndException导致的用slot接受抛错的问题

bryan31 3 年之前
父節點
當前提交
93259980dd
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java

+ 6 - 3
liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java

@@ -311,15 +311,13 @@ public class FlowExecutor {
         return this.execute2Resp(chainId, param, slotClazz, null, false);
     }
 
-    private final ArrayList<Class<? extends Exception>> notFailExceptionList = ListUtil.toList(ChainEndException.class);
-
     public <T extends Slot> LiteflowResponse<T> execute2Resp(String chainId, Object param, Class<T> slotClazz, Integer slotIndex,
                                                              boolean isInnerChain) {
         LiteflowResponse<T> response = new LiteflowResponse<>();
 
         T slot = doExecute(chainId, param, slotClazz, slotIndex, isInnerChain);
 
-        if (ObjectUtil.isNotNull(slot.getException()) && !notFailExceptionList.contains(slot.getException().getClass())) {
+        if (ObjectUtil.isNotNull(slot.getException())) {
             response.setSuccess(false);
             response.setMessage(slot.getException().getMessage());
             response.setCause(slot.getException());
@@ -377,6 +375,11 @@ public class FlowExecutor {
 
             // 执行chain
             chain.execute(slotIndex);
+        } catch (ChainEndException e) {
+            if (ObjectUtil.isNotNull(chain)){
+                String warnMsg = StrUtil.format("[{}]:chain[{}] execute end on slot[{}]", slot.getRequestId(), chain.getChainName(), slotIndex);
+                LOG.warn(warnMsg);
+            }
         } catch (Exception e) {
             if (ObjectUtil.isNotNull(chain)){
                 String errMsg = StrUtil.format("[{}]:chain[{}] execute error on slot[{}]", slot.getRequestId(), chain.getChainName(), slotIndex);