@@ -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
@@ -264,7 +267,10 @@ def acquire_for_read(self):
264267 address = next (self .routing_table .readers )
265268 try :
266269 connection = self .acquire (address )
267- except ServiceUnavailable :
270+ except ServiceUnavailable as error :
271+ if error .code == "Neo.ClientError.Security.Unauthorized" :
272+ from neo4j .v1 .security import Unauthorized
273+ raise Unauthorized (error .args [0 ])
268274 self .remove (address )
269275 else :
270276 return connection
@@ -279,7 +285,10 @@ def acquire_for_write(self):
279285 address = next (self .routing_table .writers )
280286 try :
281287 connection = self .acquire (address )
282- except ServiceUnavailable :
288+ except ServiceUnavailable as error :
289+ if error .code == "Neo.ClientError.Security.Unauthorized" :
290+ from neo4j .v1 .security import Unauthorized
291+ raise Unauthorized (error .args [0 ])
283292 self .remove (address )
284293 else :
285294 return connection
0 commit comments