From bc0776657553bd5626c75a6a5200345408688b18 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 9 Jun 2023 17:08:11 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20chore(base.py):=20add=20logger?= =?UTF-8?q?=20to=20Graph=20class=20=F0=9F=90=9B=20fix(base.py):=20improve?= =?UTF-8?q?=20error=20message=20when=20invalid=20payload=20is=20received?= =?UTF-8?q?=20The=20logger=20is=20added=20to=20the=20Graph=20class=20to=20?= =?UTF-8?q?improve=20debugging=20capabilities.=20The=20error=20message=20w?= =?UTF-8?q?hen=20an=20invalid=20payload=20is=20received=20is=20improved=20?= =?UTF-8?q?to=20include=20the=20keys=20that=20were=20found=20in=20the=20pa?= =?UTF-8?q?yload.=20This=20makes=20it=20easier=20to=20identify=20the=20iss?= =?UTF-8?q?ue=20and=20fix=20it.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/graph/graph/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/graph/graph/base.py b/src/backend/langflow/graph/graph/base.py index 5fd00d09b..3653a0ec5 100644 --- a/src/backend/langflow/graph/graph/base.py +++ b/src/backend/langflow/graph/graph/base.py @@ -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."""