fix: Add null check for logic node expression to prevent AttributeError
Problem: Logic nodes without logic_expression defined caused AttributeError "'NoneType' object has no attribute 'operator'" when evaluating condition. Solution: Check both node.condition AND node.condition.expression before calling evaluate_logic_expression(). Return clear FAILED state with error message instead of crashing. Impact: Workflows with incomplete logic node definitions now fail gracefully with clear error message instead of cryptic AttributeError.
This commit is contained in:
parent
e09cbc112e
commit
60f6cf3c6d
|
|
@ -398,8 +398,16 @@ def execute_logic_node(
|
||||||
started_at = datetime.utcnow().isoformat()
|
started_at = datetime.utcnow().isoformat()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not node.condition:
|
if not node.condition or not node.condition.expression:
|
||||||
raise ValueError(f"Logic node {node.id} has no condition")
|
error_msg = f"Logic node {node.id} has no condition/expression defined"
|
||||||
|
logger.error(error_msg)
|
||||||
|
return NodeExecutionState(
|
||||||
|
node_id=node.id,
|
||||||
|
status=NodeStatus.FAILED,
|
||||||
|
error=error_msg,
|
||||||
|
started_at=started_at,
|
||||||
|
completed_at=datetime.utcnow().isoformat()
|
||||||
|
)
|
||||||
|
|
||||||
# 1. Evaluiere Bedingung
|
# 1. Evaluiere Bedingung
|
||||||
result, error = evaluate_logic_expression(node.condition.expression, context)
|
result, error = evaluate_logic_expression(node.condition.expression, context)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user