You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In version 5.26.0, we introduce GQL compliant data on errors.
To that extend, both neo4j.exceptions.Neo4jError as well as neo4j.exceptions.DriverError have a new base class called GqlError which exposes all new data.
N.B., you'll need a new enough DBMS server to receive any meaningful data (at least version 5.26, newer is better). If the driver is connected to an older DBMS, the GQLSTATUS will default to "50N42". Likewise, will the DBMS use this code for errors that have not yet been fully migrated to the new GQL style.
Example Usage
importneo4j.exceptionsURL="neo4j://localhost:7687"AUTH= ("neo4j", "pass") withneo4j.GraphDatabase.driver(URL, auth=AUTH) asdriver: not_a_user_name= ["nope"] try: driver.execute_query( "RETURN 1 AS n", database_="neo4j", impersonated_user_=not_a_user_name, ) exceptneo4j.exceptions.Neo4jErrorase: print("=== Old Error Data: ===") print("code", e.code) print("message", e.message) print("\n=== New Error Data: ===") print("GQL status", e.gql_status) # the message might change in the future, but will remain availableprint("message", e.message) print("GQL status description", e.gql_status_description) print("GQL diagnostic record", e.diagnostic_record) # vendor specific dataprint("GQL classification (raw)", e.gql_raw_classification) print("GQL classification (parsed)", e.gql_classification)
Yields
=== Old Error Data: === code Neo.ClientError.Request.Invalid message Illegal value for field "metadata": Illegal value for field "imp_user": Expected string === New Error Data: === GQL status 08N06 message Illegal value for field "metadata": Illegal value for field "imp_user": Expected string GQL status description error: connection exception - protocol error. General network protocol error. GQL diagnostic record {'_classification': 'CLIENT_ERROR', 'OPERATION': '', 'OPERATION_CODE': '0', 'CURRENT_SCHEMA': '/'} GQL classification (raw) CLIENT_ERROR GQL classification (parsed) GqlErrorClassification.CLIENT_ERROR
Feedback wanted
This new API is currently marked as preview. What it means is that we are eagerly waiting for your feedback. Does it work well in your scenario? Do you wish there was more?
Let us know so we can correct course in the next releases!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
GQL Compliant Errors
In version 5.26.0, we introduce GQL compliant data on errors.
To that extend, both
neo4j.exceptions.Neo4jError
as well asneo4j.exceptions.DriverError
have a new base class calledGqlError
which exposes all new data.N.B., you'll need a new enough DBMS server to receive any meaningful data (at least version 5.26, newer is better).
If the driver is connected to an older DBMS, the GQLSTATUS will default to
"50N42"
.Likewise, will the DBMS use this code for errors that have not yet been fully migrated to the new GQL style.
Example Usage
Yields
Feedback wanted
This new API is currently marked as preview. What it means is that we are eagerly waiting for your feedback. Does it work well in your scenario? Do you wish there was more?
Let us know so we can correct course in the next releases!
Beta Was this translation helpful? Give feedback.
All reactions