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

There are other errors that could happen when refreshing the schema, so
we want to propagate specific errors for more clarity
This commit is contained in:
Tomaz Bratanic 2024-02-08 04:16:14 +01:00 committed by GitHub
parent d903fa313e
commit 7e4b676d53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -133,12 +133,14 @@ class Neo4jGraph(GraphStore):
# Set schema
try:
self.refresh_schema()
except neo4j.exceptions.ClientError:
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: