Skip to content

Commit

Permalink
feat(engine): Check that all lines of for_each return an IterableExpr
Browse files Browse the repository at this point in the history
  • Loading branch information
daryllimyt committed Jun 14, 2024
1 parent 516b624 commit bc8eb70
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tracecat/dsl/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ async def run_udf(input: UDFActionInput) -> Any:
)
if isinstance(iterable_exprs, IterableExpr):
iterable_exprs = [iterable_exprs]
elif not (
isinstance(iterable_exprs, list)
and all(isinstance(expr, IterableExpr) for expr in iterable_exprs)
):
raise ValueError(
"Invalid for_each expression. Must be an IterableExpr or a list of IterableExprs."
)

act_logger.info("Running in loop")
act_logger.debug("Iterables", iter_expr=iterable_exprs)
Expand Down

0 comments on commit bc8eb70

Please sign in to comment.