diff options
author | Jeff Widman <jeff@jeffwidman.com> | 2017-12-07 15:07:31 -0800 |
---|---|---|
committer | Jeff Widman <jeff@jeffwidman.com> | 2017-12-07 18:45:42 -0800 |
commit | 43511aa7fac950e07376872443db133cbb21530c (patch) | |
tree | 50bf55ebe41bb457906cabc575c6c2d12da630e3 /kafka | |
parent | 009290ddd5d4616d70bff93f841e773af8b22750 (diff) | |
download | kafka-python-minor-exception-cleanup.tar.gz |
Minor Exception cleanupminor-exception-cleanup
Diffstat (limited to 'kafka')
-rw-r--r-- | kafka/conn.py | 2 | ||||
-rw-r--r-- | kafka/consumer/fetcher.py | 4 | ||||
-rw-r--r-- | kafka/metrics/metric_name.py | 4 | ||||
-rw-r--r-- | kafka/protocol/types.py | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/kafka/conn.py b/kafka/conn.py index e20210a..309b790 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -47,7 +47,7 @@ try: SSLWantReadError = ssl.SSLWantReadError SSLWantWriteError = ssl.SSLWantWriteError SSLZeroReturnError = ssl.SSLZeroReturnError - except: + except AttributeError: # support older ssl libraries log.warning('Old SSL module detected.' ' SSL error handling may not operate cleanly.' diff --git a/kafka/consumer/fetcher.py b/kafka/consumer/fetcher.py index e4d76cf..f9251fd 100644 --- a/kafka/consumer/fetcher.py +++ b/kafka/consumer/fetcher.py @@ -478,8 +478,8 @@ class Fetcher(six.Iterator): # caught by the generator. We want all exceptions to be raised # back to the user. See Issue 545 except StopIteration as e: - log.exception('StopIteration raised unpacking messageset: %s', e) - raise Exception('StopIteration raised unpacking messageset') + log.exception('StopIteration raised unpacking messageset') + raise RuntimeError('StopIteration raised unpacking messageset') def __iter__(self): # pylint: disable=non-iterator-returned return self diff --git a/kafka/metrics/metric_name.py b/kafka/metrics/metric_name.py index a475d6c..b5acd16 100644 --- a/kafka/metrics/metric_name.py +++ b/kafka/metrics/metric_name.py @@ -50,9 +50,9 @@ class MetricName(object): tags (dict, optional): Additional key/val attributes of the metric. """ if not (name and group): - raise Exception('name and group must be non-empty.') + raise ValueError('name and group must be non-empty.') if tags is not None and not isinstance(tags, dict): - raise Exception('tags must be a dict if present.') + raise ValueError('tags must be a dict if present.') self._name = name self._group = group diff --git a/kafka/protocol/types.py b/kafka/protocol/types.py index 22b49a4..99dc2a2 100644 --- a/kafka/protocol/types.py +++ b/kafka/protocol/types.py @@ -144,7 +144,7 @@ class Schema(AbstractType): field_val = value[i] key_vals.append('%s=%s' % (self.names[i], self.fields[i].repr(field_val))) return '(' + ', '.join(key_vals) + ')' - except: + except Exception: return repr(value) |