Slightly safer socket.error handling
This commit is contained in:
parent
8003c738ca
commit
244e09f57a
|
@ -1608,7 +1608,10 @@ class Transport (threading.Thread):
|
||||||
self.saved_exception = e
|
self.saved_exception = e
|
||||||
except socket.error, e:
|
except socket.error, e:
|
||||||
if type(e.args) is tuple:
|
if type(e.args) is tuple:
|
||||||
|
if e.args:
|
||||||
emsg = '%s (%d)' % (e.args[1], e.args[0])
|
emsg = '%s (%d)' % (e.args[1], e.args[0])
|
||||||
|
else: # empty tuple, e.g. socket.timeout
|
||||||
|
emsg = str(e) or repr(e)
|
||||||
else:
|
else:
|
||||||
emsg = e.args
|
emsg = e.args
|
||||||
self._log(ERROR, 'Socket exception: ' + emsg)
|
self._log(ERROR, 'Socket exception: ' + emsg)
|
||||||
|
|
Loading…
Reference in New Issue