@@ -178,7 +178,10 @@ def fetch_routing_info(self, address):
178178 raise ServiceUnavailable ("Server %r does not support routing" % (address ,))
179179 else :
180180 raise ServiceUnavailable ("Routing support broken on server %r" % (address ,))
181- except ServiceUnavailable :
181+ except ServiceUnavailable as error :
182+ if error .code == "Neo.ClientError.Security.Unauthorized" :
183+ from neo4j .v1 .security import Unauthorized
184+ raise Unauthorized (error .args [0 ])
182185 self .remove (address )
183186 return None
184187
@@ -270,7 +273,10 @@ def acquire_for_read(self):
270273 address = next (self .routing_table .readers )
271274 try :
272275 connection = self .acquire (address )
273- except ServiceUnavailable :
276+ except ServiceUnavailable as error :
277+ if error .code == "Neo.ClientError.Security.Unauthorized" :
278+ from neo4j .v1 .security import Unauthorized
279+ raise Unauthorized (error .args [0 ])
274280 self .remove (address )
275281 else :
276282 return connection
@@ -285,7 +291,10 @@ def acquire_for_write(self):
285291 address = next (self .routing_table .writers )
286292 try :
287293 connection = self .acquire (address )
288- except ServiceUnavailable :
294+ except ServiceUnavailable as error :
295+ if error .code == "Neo.ClientError.Security.Unauthorized" :
296+ from neo4j .v1 .security import Unauthorized
297+ raise Unauthorized (error .args [0 ])
289298 self .remove (address )
290299 else :
291300 return connection
0 commit comments