🔊 chore(base.py): add logger to Graph class
🐛 fix(base.py): improve error message when invalid payload is received
The logger is added to the Graph class to improve debugging capabilities. The error message when an invalid payload is received is improved to include the keys that were found in the payload. This makes it easier to identify the issue and fix it.
This commit is contained in:
parent
bfb4a8e609
commit
bc07766575
1 changed files with 4 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ from langflow.graph.vertex.types import (
|
|||
)
|
||||
from langflow.interface.tools.constants import FILE_TOOLS
|
||||
from langflow.utils import payload
|
||||
from langflow.utils.logger import logger
|
||||
|
||||
|
||||
class Graph:
|
||||
|
|
@ -43,7 +44,9 @@ class Graph:
|
|||
edges = payload["edges"]
|
||||
return cls(nodes, edges)
|
||||
except KeyError as exc:
|
||||
raise ValueError("Invalid payload") from exc
|
||||
raise ValueError(
|
||||
f"Invalid payload. Expected keys 'nodes' and 'edges'. Found {list(payload.keys())}"
|
||||
) from exc
|
||||
|
||||
def _build_graph(self) -> None:
|
||||
"""Builds the graph from the nodes and edges."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue