summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2022-11-17 15:55:42 +0100
committerJose M. Guisado <jguisado@soleta.eu>2022-11-17 15:55:42 +0100
commit699a6c242ae0ed31e69559f7684db3f83932a07b (patch)
tree3ed1c91a8ea780b0076dfbbab8e640ac2b6b079d /src/utils
parent94f6793f96e75292bdccf20e58e1769b992f4db2 (diff)
live: improve error pathsv1.2.3
Fix error paths in live operations which do not reset the "browser" to the main page (one with the menu). Add error logging messages when: * _restartBrowser fails. * ogChangeRepo fails. Improve checksum fetch error handling. For example, when an invalid repository IP is specified.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/tiptorrent.py11
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