Apply suggestions from code review

Co-authored-by: William FH <13333726+hinthornw@users.noreply.github.com>
This commit is contained in:
Nuno Campos
2024-09-19 14:37:32 -07:00
committed by GitHub
co-authored by William FH
parent 95c1ca3adc
commit a47dc2b634
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -194,7 +194,7 @@ class Graph:
"Node name must be provided if action is not a function"
)
if action is None:
raise RuntimeError
raise RuntimeError(f"Expected a function or Runnable action in add_node. Received None.")
if node in self.nodes:
raise ValueError(f"Node `{node}` already present.")
if node == END or node == START:
+1 -1
View File
@@ -320,7 +320,7 @@ class StateGraph(Graph):
)
if not isinstance(node, str):
action = node
node = getattr(action, "name", getattr(action, "__name__"))
node = getattr(action, "name", getattr(action, "__name__", None))
if node is None:
raise ValueError(
"Node name must be provided if action is not a function"