Skip to content

Commit

Permalink
Collapse socket errors into one except block
Browse files Browse the repository at this point in the history
  • Loading branch information
agberk authored Mar 31, 2017
1 parent 543befa commit b82d36b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions betfairlightweight/streaming/betfairstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,9 @@ def _read_loop(self):
for received_data in received_data_split:
if received_data:
self._data(received_data)
except socket.timeout as e:
except (socket.timeout, socket.error) as e:
self.stop()
raise SocketError('[Connect: %s]: Socket timeout, %s' % (self.unique_id, e))
except socket.error as e:
self.stop()
raise SocketError('[Connect: %s]: Socket error, %s' % (self.unique_id, e))
raise SocketError('[Connect: %s]: Socket %s' % (self.unique_id, e))

def _receive_all(self):
"""Whilst socket is running receives data from socket,
Expand Down

0 comments on commit b82d36b

Please sign in to comment.