summaryrefslogtreecommitdiff
path: root/kafka/conn.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@rd.io>2015-12-30 16:16:13 -0800
committerDana Powers <dana.powers@rd.io>2015-12-30 16:16:13 -0800
commit422050f952344e4796725d88db55a983bae4e1ee (patch)
tree27900edea1b16218d0dc01c8b5c166d2ec43afc0 /kafka/conn.py
parent59c051314890a0a6713e6fdb28d74bc3dc053aa9 (diff)
downloadkafka-python-422050f952344e4796725d88db55a983bae4e1ee.tar.gz
Prefer assert or more-specific error to IllegalState / IllegalArgument
Diffstat (limited to 'kafka/conn.py')
-rw-r--r--kafka/conn.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/kafka/conn.py b/kafka/conn.py
index 3e49841..a1767ef 100644
--- a/kafka/conn.py
+++ b/kafka/conn.py
@@ -190,9 +190,7 @@ class BrokerConnection(object):
Return response if available
"""
- if self._processing:
- raise Errors.IllegalStateError('Recursive connection processing'
- ' not supported')
+ assert not self._processing, 'Recursion not supported'
if not self.connected():
log.warning('%s cannot recv: socket not connected', self)
# If requests are pending, we should close the socket and
@@ -272,11 +270,8 @@ class BrokerConnection(object):
return response
def _process_response(self, read_buffer):
- if self._processing:
- raise Errors.IllegalStateError('Recursive connection processing'
- ' not supported')
- else:
- self._processing = True
+ assert not self._processing, 'Recursion not supported'
+ self._processing = True
ifr = self.in_flight_requests.popleft()
# verify send/recv correlation ids match