Skip to content

Commit 276f8fc

Browse files
Print error when node is missing.
1 parent 4bc1884 commit 276f8fc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

execution.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,13 +625,23 @@ def validate_prompt(prompt):
625625
if 'class_type' not in prompt[x]:
626626
error = {
627627
"type": "invalid_prompt",
628-
"message": f"Cannot execute due to a missing node",
628+
"message": f"Cannot execute because a node is missing the class_type property.",
629+
"details": f"Node ID '#{x}'",
630+
"extra_info": {}
631+
}
632+
return (False, error, [], [])
633+
634+
class_type = prompt[x]['class_type']
635+
class_ = nodes.NODE_CLASS_MAPPINGS.get(class_type, None)
636+
if class_ is None:
637+
error = {
638+
"type": "invalid_prompt",
639+
"message": f"Cannot execute because node {class_type} does not exist.",
629640
"details": f"Node ID '#{x}'",
630641
"extra_info": {}
631642
}
632643
return (False, error, [], [])
633644

634-
class_ = nodes.NODE_CLASS_MAPPINGS[prompt[x]['class_type']]
635645
if hasattr(class_, 'OUTPUT_NODE') and class_.OUTPUT_NODE is True:
636646
outputs.add(x)
637647

0 commit comments

Comments
 (0)