Prechádzať zdrojové kódy

Supress any kind of exception if version check fails

 * Problems with checking the version on the server side
   should not affect end users
Oz N Tiram 8 rokov pred
rodič
commit
3e1736007d
1 zmenil súbory, kde vykonal 10 pridanie a 7 odobranie
  1. 10 7
      pwman/ui/cli.py

+ 10 - 7
pwman/ui/cli.py

@@ -95,13 +95,16 @@ def get_ui_platform(platform):  # pragma: no cover
 
 def is_latest_version():  # pragma: no cover
     """check current version againt latest version"""
-    conn = http.client.HTTPConnection("pwman.tiram.it", timeout=0.5)
-    conn.request("GET", "/")
-    r = conn.getresponse()
-    data = r.read()  # This will return entire content.
-    if data.decode().split(".") > version.split("."):
-        return False
-    else:
+    try:
+        conn = http.client.HTTPConnection("pwman.tiram.it", timeout=0.5)
+        conn.request("GET", "/")
+        r = conn.getresponse()
+        data = r.read()  # This will return entire content.
+        if data.decode().split(".") > version.split("."):
+            return False
+        else:
+            return True
+    except Exception:
         return True