forked from openlp/openlp
Improve network exception handling.
This commit is contained in:
parent
14031720be
commit
7eb506fae8
@ -414,6 +414,11 @@ def get_web_page(url, header=None, update_openlp=False):
|
|||||||
page = None
|
page = None
|
||||||
if retries > CONNECTION_RETRIES:
|
if retries > CONNECTION_RETRIES:
|
||||||
raise
|
raise
|
||||||
|
except socket.gaierror:
|
||||||
|
log.exception('Socket gaierror: {}'.format(url))
|
||||||
|
page = None
|
||||||
|
if retries > CONNECTION_RETRIES:
|
||||||
|
raise
|
||||||
except ConnectionRefusedError:
|
except ConnectionRefusedError:
|
||||||
log.exception('ConnectionRefused: {}'.format(url))
|
log.exception('ConnectionRefused: {}'.format(url))
|
||||||
page = None
|
page = None
|
||||||
|
@ -748,7 +748,10 @@ def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None, pre
|
|||||||
"""
|
"""
|
||||||
if not reference_url:
|
if not reference_url:
|
||||||
return None
|
return None
|
||||||
|
try:
|
||||||
page = get_web_page(reference_url, header, True)
|
page = get_web_page(reference_url, header, True)
|
||||||
|
except:
|
||||||
|
page = None
|
||||||
if not page:
|
if not page:
|
||||||
send_error_message('download')
|
send_error_message('download')
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user