Tony Ennis
Tony Ennis

Reputation: 12289

import for py2neo.error.CypherExecutionException

I'm expectedly getting a CypherExecutionException. I would like to catch it but I can't seem to find the import for it.

Where is it? How do I find it myself next time?

Upvotes: 3

Views: 150

Answers (1)

Nigel Small
Nigel Small

Reputation: 4495

Depending on which version of py2neo you're using, and which Cypher endpoint - legacy or transactional - this may be one of the auto-generated errors built dynamically from the server response. Newer functionality (i.e. the transaction endpoint) no longer does this and instead holds hard-coded definitions for all exceptions for just this reason. This wasn't possible for the legacy endpoint when the full list of possible exceptions was undocumented.

You should however be able to catch py2neo.error.GraphError instead which is the base class from which these dynamic errors inherit. You can then study the attributes of that error for more specific checking.

Upvotes: 1

Related Questions