Catch raw socket errors

This commit is contained in:
Kenneth Reitz
2011-10-13 20:47:58 -04:00
parent 565745f7b7
commit 597f0ae5fd
+2
View File
@@ -361,6 +361,8 @@ class Request(object):
if hasattr(why, 'reason'):
if isinstance(why.reason, socket.timeout):
why = Timeout(why)
elif isinstance(why.reason, socket.error):
why = Timeout(why)
self._build_response(why, is_error=True)