catch streaming errors
This commit is contained in:
parent
ade2ee68a4
commit
330522341a
@ -73,8 +73,11 @@ def _download_image(image_info):
|
|||||||
|
|
||||||
image_location = _image_location(image_info)
|
image_location = _image_location(image_info)
|
||||||
with open(image_location, 'wb') as f:
|
with open(image_location, 'wb') as f:
|
||||||
for chunk in resp.iter_content(1024 * 1024):
|
try:
|
||||||
f.write(chunk)
|
for chunk in resp.iter_content(1024 * 1024):
|
||||||
|
f.write(chunk)
|
||||||
|
except Exception:
|
||||||
|
raise errors.ImageDownloadError(image_info['id'])
|
||||||
|
|
||||||
if not _verify_image(image_info, image_location):
|
if not _verify_image(image_info, image_location):
|
||||||
raise errors.ImageChecksumError(image_info['id'])
|
raise errors.ImageChecksumError(image_info['id'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user