From 948f8063723e5480c30f780db554e2c464e61644 Mon Sep 17 00:00:00 2001 From: Drew C <31282527+drewc5131@users.noreply.github.com> Date: Mon, 23 Nov 2020 20:48:31 -0500 Subject: [PATCH] the app should no longer crash if it can't check for udpates --- ttle.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ttle.py b/ttle.py index 3c75d4a..b0cdb38 100644 --- a/ttle.py +++ b/ttle.py @@ -108,15 +108,18 @@ def __init__(self): async def checkUpdates(self): import aiohttp async with aiohttp.ClientSession() as session: - async with session.get("https://raw.githubusercontent.com/OpenToontownTools/TTOpenLevelEditor/master/ver") as resp: - ver = await resp.text() - ver = ver.splitlines()[0] - if ver != self.APP_VERSION: - self.notify.info(f"Client is out of date! Latest: {ver} | Client: {self.APP_VERSION}") - if messagebox.askokcancel("Error", f"Client is out of date!\nLatest: {ver} | Client: {self.APP_VERSION}. Press OK to be taken to the download page."): - webbrowser.open("https://github.com/OpenToontownTools/TTOpenLevelEditor/releases/latest") - else: - self.notify.info("Client is up to date!") + try: + async with session.get("https://raw.githubusercontent.com/OpenToontownTools/OpenLevelEditor/master/ver") as resp: + ver = await resp.text() + ver = ver.splitlines()[0] + if ver != self.APP_VERSION: + self.notify.info(f"Client is out of date! Latest: {ver} | Client: {self.APP_VERSION}") + if messagebox.askokcancel("Error", f"Client is out of date!\nLatest: {ver} | Client: {self.APP_VERSION}. Press OK to be taken to the download page."): + webbrowser.open("https://github.com/OpenToontownTools/OpenLevelEditor/releases/latest") + else: + self.notify.info("Client is up to date!") + except: + messagebox.showerror(message = "There was an error checking for updates! This is likely an issue with your connection. Press OK to continue using the application.") # Run it ToontownLevelEditor().run()