From b015f11fcb66eee91dfb1a6899709f6d0fafa7f6 Mon Sep 17 00:00:00 2001 From: martin bendsoe Date: Tue, 7 Jul 2020 12:13:23 +0200 Subject: [PATCH] improved documentation and __str__ for Neo4jError --- docs/source/api.rst | 14 ++++++++++++-- neo4j/exceptions.py | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/source/api.rst b/docs/source/api.rst index 57059f442..7f8570755 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -1112,8 +1112,18 @@ Neo4j Execution Errors .. autoclass:: neo4j.exceptions.Neo4jError - Raised when the Cypher engine returns an error to the client. - There are many possible types of Cypher error, each identified by a unique `status code `_. + .. autoproperty:: message + + .. autoproperty:: code + + There are many Neo4j status codes, see `status code `_. + + .. autoproperty:: classification + + .. autoproperty:: category + + .. autoproperty:: title + .. autoclass:: neo4j.exceptions.ClientError :show-inheritance: diff --git a/neo4j/exceptions.py b/neo4j/exceptions.py index 4a7b05b28..91e7c72d3 100644 --- a/neo4j/exceptions.py +++ b/neo4j/exceptions.py @@ -124,6 +124,9 @@ def _extract_error_class(cls, classification, code): else: return cls + def __str__(self): + return "{{code: {code}}} {{message: {message}}}".format(code=self.code, message=self.message) + class ClientError(Neo4jError): """ The Client sent a bad request - changing the request might yield a successful outcome.