verifybinaries: catch the correct exception

This commit is contained in:
Cory Fields 2023-04-06 19:35:54 +00:00
parent 4b23b488d2
commit 8a65e5145c

View file

@ -40,6 +40,7 @@ import shutil
import tempfile import tempfile
import textwrap import textwrap
import urllib.request import urllib.request
import urllib.error
import enum import enum
from hashlib import sha256 from hashlib import sha256
from pathlib import PurePath, Path from pathlib import PurePath, Path
@ -126,7 +127,7 @@ def download_lines_with_urllib(url) -> t.Tuple[bool, t.List[str]]:
try: try:
return (True, [ return (True, [
line.strip().decode() for line in urllib.request.urlopen(url).readlines()]) line.strip().decode() for line in urllib.request.urlopen(url).readlines()])
except urllib.request.HTTPError as e: except urllib.error.HTTPError as e:
log.warning(f"HTTP request to {url} failed (HTTPError): {e}") log.warning(f"HTTP request to {url} failed (HTTPError): {e}")
except Exception as e: except Exception as e:
log.warning(f"HTTP request to {url} failed ({e})") log.warning(f"HTTP request to {url} failed ({e})")