mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-05 16:18:02 +01:00
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.
This commit is contained in:
@@ -304,8 +304,11 @@ def _get_response(request, auth, template):
|
|||||||
r = urllib2.urlopen(request)
|
r = urllib2.urlopen(request)
|
||||||
except urllib2.HTTPError as exc:
|
except urllib2.HTTPError as exc:
|
||||||
errors, should_continue = _request_http_error(exc, auth, errors) # noqa
|
errors, should_continue = _request_http_error(exc, auth, errors) # noqa
|
||||||
|
r = exc
|
||||||
except urllib2.URLError:
|
except urllib2.URLError:
|
||||||
should_continue = _request_url_error(template, retry_timeout)
|
should_continue = _request_url_error(template, retry_timeout)
|
||||||
|
if not should_continue:
|
||||||
|
raise
|
||||||
|
|
||||||
if should_continue:
|
if should_continue:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user