From cf88f4b92f3b7a3149a1c89a992894192541b507 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 3 Dec 2025 12:24:47 +0100 Subject: [PATCH] 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`. --- syncpackage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncpackage b/syncpackage index b024e76..4008747 100755 --- a/syncpackage +++ b/syncpackage @@ -462,7 +462,7 @@ def is_blocklisted(query): try: with urllib.request.urlopen(url) as f: 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.") return ("ALWAYS", "INTERNAL ERROR: Unable to fetch sync blocklist")