Skip to content

Commit 43f571e

Browse files
improved documentation and __str__ for Neo4jError (#441)
1 parent 6774c46 commit 43f571e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

docs/source/api.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,18 @@ Neo4j Execution Errors
11121112
11131113
.. autoclass:: neo4j.exceptions.Neo4jError
11141114
1115-
Raised when the Cypher engine returns an error to the client.
1116-
There are many possible types of Cypher error, each identified by a unique `status code <https://neo4j.com/docs/status-codes/current/>`_.
1115+
.. autoproperty:: message
1116+
1117+
.. autoproperty:: code
1118+
1119+
There are many Neo4j status codes, see `status code <https://neo4j.com/docs/status-codes/current/>`_.
1120+
1121+
.. autoproperty:: classification
1122+
1123+
.. autoproperty:: category
1124+
1125+
.. autoproperty:: title
1126+
11171127
11181128
.. autoclass:: neo4j.exceptions.ClientError
11191129
:show-inheritance:

neo4j/exceptions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ def _extract_error_class(cls, classification, code):
124124
else:
125125
return cls
126126

127+
def __str__(self):
128+
return "{{code: {code}}} {{message: {message}}}".format(code=self.code, message=self.message)
129+
127130

128131
class ClientError(Neo4jError):
129132
""" The Client sent a bad request - changing the request might yield a successful outcome.

0 commit comments

Comments
 (0)