Reraise exception if retries > CONNECTION_RETRIES

This commit is contained in:
Ken Roberts 2015-02-19 09:17:04 -08:00
parent fd81d2d80a
commit b62bb37776
1 changed files with 8 additions and 0 deletions

View File

@ -407,16 +407,24 @@ def get_web_page(url, header=None, update_openlp=False):
log.exception('URLError on {}'.format(url))
log.exception('URLError: {}'.format(err.reason))
page = None
if retries > CONNECTION_RETRIES:
raise
except socket.timeout:
log.exception('Socket timeout: {}'.format(url))
page = None
if retries > CONNECTION_RETRIES:
raise
except ConnectionRefusedError:
log.exception('ConnectionRefused: {}'.format(url))
page = None
if retries > CONNECTION_RETRIES:
raise
break
except ConnectionError:
log.exception('Connection error: {}'.format(url))
page = None
if retries > CONNECTION_RETRIES:
raise
except:
# Don't know what's happening, so reraise the original
raise