From 4cb6e5d1b63080c2aadac267bdd60aa445cbe0f1 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 2 Oct 2011 10:07:01 +0100 Subject: [PATCH] Report socket errors as DownloadErrors Also, give the URL of the download that failed in the error message. --- zeroinstall/injector/_download_child.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zeroinstall/injector/_download_child.py b/zeroinstall/injector/_download_child.py index 9d43a7e..f81b8b6 100644 --- a/zeroinstall/injector/_download_child.py +++ b/zeroinstall/injector/_download_child.py @@ -60,13 +60,13 @@ def download_in_thread(url, target_file, if_modified_since, notify_done): target_file.flush() notify_done(download.RESULT_OK) - except (urllib2.HTTPError, urllib2.URLError, httplib.HTTPException) as ex: + except (urllib2.HTTPError, urllib2.URLError, httplib.HTTPException, socket.error) as ex: if isinstance(ex, urllib2.HTTPError) and ex.code == 304: # Not modified notify_done(download.RESULT_NOT_MODIFIED) else: #print >>sys.stderr, "Error downloading '" + url + "': " + (str(ex) or str(ex.__class__.__name__)) __, ex, tb = sys.exc_info() - notify_done(download.RESULT_FAILED, (download.DownloadError(unicode(ex)), tb)) + notify_done(download.RESULT_FAILED, (download.DownloadError(_('Error downloading {url}: {ex}').format(url = url, ex = ex)), tb)) except Exception as ex: __, ex, tb = sys.exc_info() notify_done(download.RESULT_FAILED, (ex, tb)) -- 2.11.4.GIT