summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-02-10 17:06:33 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-02-11 16:04:44 +0000
commitfe531122452a394f738690a15e789f34a9580b0d (patch)
tree8f384a4650a11fd84a75ae531d5c02245f300034
parentd3d4c783f2cb5a5d952629f0b9e022b5defc1b01 (diff)
downloadmorph-fe531122452a394f738690a15e789f34a9580b0d.tar.gz
remoteartifactcache: Avoid crashing on connection errors
-rw-r--r--morphlib/remoteartifactcache.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/morphlib/remoteartifactcache.py b/morphlib/remoteartifactcache.py
index e53c3985..b7aa7466 100644
--- a/morphlib/remoteartifactcache.py
+++ b/morphlib/remoteartifactcache.py
@@ -105,16 +105,16 @@ class RemoteArtifactCache(object):
for i, chunk in enumerate(response.iter_content(chunk_size)):
local_file.write(chunk)
show_status((i+1) * chunk_size, content_length)
- except (socket.timeout, requests.exceptions.Timeout) as e:
- logging.debug(str(e))
- raise GetError(self, remote_filename, e)
except requests.exceptions.HTTPError as e:
logging.debug(str(e))
if e.response.status_code == 404:
if error_if_missing:
- raise NotCachedError()
+ raise NotCachedError(self, remote_filename, e)
else:
raise GetError(self, remote_filename, e)
+ except (IOError, requests.exceptions.RequestException) as e:
+ logging.debug(str(e))
+ raise GetError(self, remote_filename, e)
def _fetch_files(self, to_fetch, status_cb):
'''Fetch a set of files atomically.