mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-23 16:12:25 +02:00
Apply suggestions from code review
Co-authored-by: William FH <13333726+hinthornw@users.noreply.github.com>
This commit is contained in:
co-authored by
William FH
parent
95c1ca3adc
commit
a47dc2b634
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user