diff options
Diffstat (limited to 'src/utils/tiptorrent.py')
-rw-r--r-- | src/utils/tiptorrent.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/utils/tiptorrent.py b/src/utils/tiptorrent.py index 25a3ab8..e749d96 100644 --- a/src/utils/tiptorrent.py +++ b/src/utils/tiptorrent.py @@ -21,8 +21,15 @@ def tip_fetch_csum(tip_addr, image_name): """ """ url = f'http://{tip_addr}:9999/{image_name}.img.full.sum' - with urllib.request.urlopen(f'{url}') as resp: - r = resp.readline().rstrip().decode('utf-8') + try: + with urllib.request.urlopen(f'{url}') as resp: + r = resp.readline().rstrip().decode('utf-8') + except urllib.error.URLError as e: + logging.warning('URL error when fetching checksum: {e.reason}') + raise e + except urllib.error.HTTPError as e: + logging.warning(f'HTTP Error when fetching checksum: {e.reason}') + raise e return r |