fix: 代码节点缺失引擎时抛出明确异常
- 在 CodeNode 执行前增加运行时引擎空值校验 - 避免空指针失败,错误信息包含 engine 标识
This commit is contained in:
@@ -57,6 +57,9 @@ public class CodeNode extends BaseNode {
|
|||||||
String newCode = TextTemplate.of(code).formatToString(variables);
|
String newCode = TextTemplate.of(code).formatToString(variables);
|
||||||
|
|
||||||
CodeRuntimeEngine codeRuntimeEngine = CodeRuntimeEngineManager.getInstance().getCodeRuntimeEngine(this.engine);
|
CodeRuntimeEngine codeRuntimeEngine = CodeRuntimeEngineManager.getInstance().getCodeRuntimeEngine(this.engine);
|
||||||
|
if (codeRuntimeEngine == null) {
|
||||||
|
throw new IllegalArgumentException("code runtime engine not found: " + this.engine);
|
||||||
|
}
|
||||||
return codeRuntimeEngine.execute(newCode, this, chain);
|
return codeRuntimeEngine.execute(newCode, this, chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user