From 534145d17892e914e68699f0bac9823aa3a7065f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Wed, 21 Oct 2015 22:40:34 +0200 Subject: [PATCH] Improve error handling in case of HTTP errors In case of a HTTP status code 404, the returned 'r' was never assigned. In case of URL errors which are not timeouts, we probably should bail out. --- bin/github-backup | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/github-backup b/bin/github-backup index 4994aee..286ee54 100755 --- a/bin/github-backup +++ b/bin/github-backup @@ -304,8 +304,11 @@ def _get_response(request, auth, template): r = urllib2.urlopen(request) except urllib2.HTTPError as exc: errors, should_continue = _request_http_error(exc, auth, errors) # noqa + r = exc except urllib2.URLError: should_continue = _request_url_error(template, retry_timeout) + if not should_continue: + raise if should_continue: continue