Skip to content

Commit

Permalink
community[patch]: Better error propagation for neo4jgraph (#17190)
Browse files Browse the repository at this point in the history
There are other errors that could happen when refreshing the schema, so
we want to propagate specific errors for more clarity
  • Loading branch information
tomasonjo authored Feb 8, 2024
1 parent d903fa3 commit 7e4b676
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions libs/community/langchain_community/graphs/neo4j_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ def __init__(
# 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:
Expand Down

0 comments on commit 7e4b676

Please sign in to comment.