Skip to content

Commit b66c14c

Browse files
authored
Handle Neo.ClientError.Security.AuthorizationExpired (#540)
* Handle Neo.ClientError.Security.AuthorizationExpired - Close the connection and mark all idle connections in the pool as expired - Raise the error to the user or do a retry if inside transaction function Refactoring shared code of Bolt 3 and Bolt 4 connection into base class.
1 parent f7a2e86 commit b66c14c

15 files changed

+530
-377
lines changed

neo4j/exceptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def hydrate(cls, message=None, code=None, **metadata):
8888
code = code or "Neo.DatabaseError.General.UnknownError"
8989
try:
9090
_, classification, category, title = code.split(".")
91+
if code == "Neo.ClientError.Security.AuthorizationExpired":
92+
classification = CLASSIFICATION_TRANSIENT
9193
except ValueError:
9294
classification = CLASSIFICATION_DATABASE
9395
category = "General"
@@ -124,6 +126,9 @@ def _extract_error_class(cls, classification, code):
124126
else:
125127
return cls
126128

129+
def invalidates_all_connections(self):
130+
return self.code == "Neo.ClientError.Security.AuthorizationExpired"
131+
127132
def __str__(self):
128133
return "{{code: {code}}} {{message: {message}}}".format(code=self.code, message=self.message)
129134

0 commit comments

Comments
 (0)