Skip to content

Commit 1dd22be

Browse files
Print HTTPError nicely.
1 parent 7d3cad8 commit 1dd22be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/unicode_properties_parse/download_unicode_data_files.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from pathlib import PurePosixPath
55
import sys
6+
from urllib.error import HTTPError
67
from urllib.request import urlretrieve
78

89

@@ -36,7 +37,10 @@ def download_unicode_data_files():
3637
url = base_url + data_file
3738
filename = PurePosixPath(data_file).name
3839
print(f"Downloading: {url}")
39-
urlretrieve(url, filename)
40+
try:
41+
urlretrieve(url, filename)
42+
except HTTPError as http_error:
43+
sys.exit(f"{http_error}")
4044

4145

4246
if __name__ == "__main__":

0 commit comments

Comments
 (0)