bug #I6URNQ 在CATCH表达中写单独的组件,SLOT中会拿不到异常

This commit is contained in:
everywhere.z
2023-04-11 16:13:20 +08:00
parent eaa68adbb0
commit 385b69ba98
6 changed files with 67 additions and 3 deletions

View File

@@ -3,7 +3,9 @@ package com.yomahub.liteflow.builder.el.operator;
import com.yomahub.liteflow.builder.el.operator.base.BaseOperator;
import com.yomahub.liteflow.builder.el.operator.base.OperatorHelper;
import com.yomahub.liteflow.flow.element.Executable;
import com.yomahub.liteflow.flow.element.Node;
import com.yomahub.liteflow.flow.element.condition.CatchCondition;
import com.yomahub.liteflow.flow.element.condition.ThenCondition;
/**
* EL规则中的CATCH的操作符 用法CATCH...DO...
@@ -20,8 +22,15 @@ public class CatchOperator extends BaseOperator<CatchCondition> {
Executable catchItem = OperatorHelper.convert(objects[0], Executable.class);
CatchCondition catchCondition = new CatchCondition();
catchCondition.setCatchItem(catchItem);
//如果是单个Node的话要包装成THEN的CONDITION模式否则CATCH不到异常
if (catchItem instanceof Node){
ThenCondition thenCondition = new ThenCondition();
thenCondition.addExecutable(catchItem);
catchCondition.setCatchItem(thenCondition);
}else{
catchCondition.setCatchItem(catchItem);
}
return catchCondition;
}