diff options
author | Tim Burke <tim.burke@gmail.com> | 2016-10-28 12:19:35 +0200 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2016-10-28 17:37:37 +0200 |
commit | 481f74caf1ffc649128bb8db84ac9104304420a9 (patch) | |
tree | 061cee8f1bd7da130ed20c65609276b2ad444242 | |
parent | e9887703d09bb42ddc3ab1f38855286f8d569ad6 (diff) | |
download | python-swiftclient-481f74caf1ffc649128bb8db84ac9104304420a9.tar.gz |
Low-level API: Don't log just before raising an exception
The only logging we should do is when we've encountered a problem *and
we've dealt with it ourselves*. When we're raising an exception, it
should be up to the caller to decide whether to log anything about it.
Anything else is just rude.
Change-Id: I1c96b76d90a78b7a10ffe63e4a7440c8f579147c
Closes-Bug: 1213179
Related-Bug: 1202229
-rw-r--r-- | swiftclient/client.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py index b0d2bf3..6eefec4 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -307,9 +307,8 @@ class _RetryBody(_ObjectBody): try: buf = self.resp.read(length) self.bytes_read += len(buf) - except (socket.error, RequestException) as e: + except (socket.error, RequestException): if self.conn.attempts > self.conn.retries: - logger.exception(e) raise if (not buf and self.bytes_read < self.expected_length and self.conn.attempts <= self.conn.retries): @@ -1659,10 +1658,9 @@ class Connection(object): return rv except SSLError: raise - except (socket.error, RequestException) as e: + except (socket.error, RequestException): self._add_response_dict(caller_response_dict, kwargs) if self.attempts > self.retries: - logger.exception(e) raise self.http_conn = None except ClientException as err: @@ -1677,11 +1675,9 @@ class Connection(object): self.url = self.token = self.service_token = None if retried_auth or not should_retry: - logger.exception(err) raise retried_auth = True elif self.attempts > self.retries or err.http_status is None: - logger.exception(err) raise elif err.http_status == 408: self.http_conn = None @@ -1690,7 +1686,6 @@ class Connection(object): elif self.retry_on_ratelimit and err.http_status == 498: pass else: - logger.exception(err) raise sleep(backoff) backoff = min(backoff * 2, self.max_backoff) |