mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-12-08 16:43:51 +00:00
syncpackage: do not use bare except for urlopen()
flake8 complains: ``` ./syncpackage:465:9: E722 do not use bare 'except' ``` The function `urllib.request.urlopen` might throw `urllib.error.URLError`, `urllib.error.HTTPError`, `socket.gaierror`, `ssl.SSLError` which are all subclasses of `OSError`.
This commit is contained in:
parent
c6a4c10da2
commit
cf88f4b92f
@ -462,7 +462,7 @@ def is_blocklisted(query):
|
|||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(url) as f:
|
with urllib.request.urlopen(url) as f:
|
||||||
cached_sync_blocklist = f.read().decode("utf-8")
|
cached_sync_blocklist = f.read().decode("utf-8")
|
||||||
except:
|
except OSError:
|
||||||
print("WARNING: unable to download the sync blocklist. Erring on the side of caution.")
|
print("WARNING: unable to download the sync blocklist. Erring on the side of caution.")
|
||||||
return ("ALWAYS", "INTERNAL ERROR: Unable to fetch sync blocklist")
|
return ("ALWAYS", "INTERNAL ERROR: Unable to fetch sync blocklist")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user