feat(flow): 改进 Rhai 脚本执行错误处理和前后端代码节点映射
- 修改 eval_rhai_expr_json 返回 Result 以提供错误信息 - 统一使用 unwrap_or_else 处理 Rhai 表达式执行错误 - 前后端代码节点类型映射支持 JavaScript 和 Rhai 语言 - 前端代码编辑器添加语言选择器 - 优化 WebSocket 错误处理和关闭逻辑
This commit is contained in:
@ -166,7 +166,7 @@ pub(crate) fn resolve_value(ctx: &serde_json::Value, v: &serde_json::Value) -> R
|
||||
"expression" => {
|
||||
let expr = v.get("content").and_then(|x| x.as_str()).unwrap_or("");
|
||||
if expr.trim().is_empty() { return Ok(V::Null); }
|
||||
Ok(crate::flow::engine::eval_rhai_expr_json(expr, ctx).unwrap_or(V::Null))
|
||||
Ok(crate::flow::engine::eval_rhai_expr_json(expr, ctx).unwrap_or_else(|_| V::Null))
|
||||
}
|
||||
_ => Ok(V::Null),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user