diff options
-rw-r--r-- | kazoo/protocol/connection.py | 14 | ||||
-rw-r--r-- | kazoo/recipe/lock.py | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/kazoo/protocol/connection.py b/kazoo/protocol/connection.py index d672497..6ed5cde 100644 --- a/kazoo/protocol/connection.py +++ b/kazoo/protocol/connection.py @@ -806,11 +806,11 @@ class ConnectionHandler(object): try: response = sasl_cli.process(challenge=challenge) except puresasl.SASLError as err: - raise SASLException("library error: %s" % err) from err - except puresasl.SASLProtocolException as err: - raise AuthFailedError("protocol error: %s" % err) from err - except Exception as err: - raise AuthFailedError("Unknown error: %s" % err) from err + raise SASLException("library error") from err + except puresasl.SASLProtocolException as exc: + raise AuthFailedError("protocol error") from exc + except Exception as exc: + raise AuthFailedError("Unknown error") from exc if sasl_cli.complete and not response: break @@ -824,9 +824,9 @@ class ConnectionHandler(object): try: header, buffer, offset = self._read_header(timeout) - except ConnectionDropped as ex: + except ConnectionDropped as exc: # Zookeeper simply drops connections with failed authentication - raise AuthFailedError("Connection dropped in SASL") from ex + raise AuthFailedError("Connection dropped in SASL") from exc if header.xid != xid: raise RuntimeError( diff --git a/kazoo/recipe/lock.py b/kazoo/recipe/lock.py index 5eb66d4..59c6d8f 100644 --- a/kazoo/recipe/lock.py +++ b/kazoo/recipe/lock.py @@ -190,12 +190,12 @@ class Lock(object): ) except RetryFailedError: pass - except KazooException as ex: + except KazooException: # if we did ultimately fail, attempt to clean up if not already_acquired: self._best_effort_cleanup() self.cancelled = False - raise ex + raise if gotten: self.is_acquired = gotten if not gotten and not already_acquired: |