From 08f6b8846a2c41ee08c122859ccf04a45ace75c4 Mon Sep 17 00:00:00 2001 From: Phyks Date: Tue, 4 Nov 2014 21:51:44 +0100 Subject: [PATCH] Catch socket.error exceptions as seen in issue #20 --- libbmc/fetcher.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libbmc/fetcher.py b/libbmc/fetcher.py index f120bd6..8b99bad 100644 --- a/libbmc/fetcher.py +++ b/libbmc/fetcher.py @@ -114,9 +114,13 @@ def download(url): except ValueError: tools.warning("Invalid URL") return False, None - except URLError: - tools.warning("Unable to get "+url+" using proxy "+proxy+". It " + - "may not be available.") + except (URLError, socket.error): + if proxy != "": + proxy_txt = "using proxy "+proxy + else: + proxy_txt = "without using any proxy" + tools.warning("Unable to get "+url+" "+proxy_txt+". It " + + "may not be available at the moment.") continue return False, None