Skip to content

The agent engineering platform.

community[patch]: Better error propagation for neo4jgraph (#17190)

Tomaz Bratanic7e4b676d534b
diff --git a/libs/community/langchain_community/graphs/neo4j_graph.py b/libs/community/langchain_community/graphs/neo4j_graph.py
index 125fd96b15..9df427e38c 100644
--- a/libs/community/langchain_community/graphs/neo4j_graph.py
+++ b/libs/community/langchain_community/graphs/neo4j_graph.py
@@ -133,12 +133,14 @@ class Neo4jGraph(GraphStore):
# Set schema
try:
self.refresh_schema()
- except neo4j.exceptions.ClientError:
- raise ValueError(
- "Could not use APOC procedures. "
- "Please ensure the APOC plugin is installed in Neo4j and that "
- "'apoc.meta.data()' is allowed in Neo4j configuration "
- )
+ except neo4j.exceptions.ClientError as e:
+ if e.code == "Neo.ClientError.Procedure.ProcedureNotFound":
+ raise ValueError(
+ "Could not use APOC procedures. "
+ "Please ensure the APOC plugin is installed in Neo4j and that "
+ "'apoc.meta.data()' is allowed in Neo4j configuration "
+ )
+ raise e
@property
def get_schema(self) -> str: