From ff7aa3cac7868331febc2de85ca1caf92b1e1238 Mon Sep 17 00:00:00 2001 From: Kyle Gabriel Date: Thu, 2 Nov 2023 17:47:51 -0400 Subject: [PATCH] catch connection errors --- mycodo/utils/github_release_info.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mycodo/utils/github_release_info.py b/mycodo/utils/github_release_info.py index d1b0f2949..3efe38b02 100644 --- a/mycodo/utils/github_release_info.py +++ b/mycodo/utils/github_release_info.py @@ -4,7 +4,9 @@ import logging import os import re +import socket import sys +import urllib from urllib.request import urlopen from packaging.version import parse @@ -40,6 +42,10 @@ def update_mycodo_tags(self): tag_full = each_tag['ref'].split('/') if len(tag_full) == 3 and re.match('v(\d+)\.(\d+)\.\d+', tag_full[2]): parsed_tags.append(tag_full[2]) + except socket.gaierror: + logger.error("Cannot connect") + except urllib.error.URLError: + logger.error("Cannot resolve name") except Exception: logger.exception("update_mycodo_tags()") self.mycodo_tags = parsed_tags