From 2204b167074126540fd3955d08f6aee92a2256f2 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 18 Dec 2020 22:15:00 -0300 Subject: Smoother error handling --- game/01_init.rpy | 1 - game/03_init.rpy | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'game') diff --git a/game/01_init.rpy b/game/01_init.rpy index 9d45917..15e8b2a 100644 --- a/game/01_init.rpy +++ b/game/01_init.rpy @@ -54,7 +54,6 @@ init -3 python: allfiles=[] HOST=str(persistent.host) PORT=str(persistent.port) - UPDP=10302 FAILUREMSG="Request failed, Please try again" OFFLINEMSG="401 Unauthorized" OKMSG="200 OK" diff --git a/game/03_init.rpy b/game/03_init.rpy index f082530..90b4b3b 100644 --- a/game/03_init.rpy +++ b/game/03_init.rpy @@ -251,7 +251,14 @@ init python: f=open(get_path(addr), "w") stdout("Downloading additional file: %s" % img.replace(" ", "_")) - x=requests.get("http://%s:%d/%s?token=%s" % (HOST, UPDP, img.replace(" ", "_"), get_token())) # , timeout=8.0 → Need to handle sudden death + try: + x=requests.get("https://%s/%s?token=%s" % (HOST, img.replace(" ", "_"), get_token())) # , timeout=8.0 → Need to handle sudden death + except: + # Oh noes - something went *terribly* wrong + traceback.print_exc() + x=requests.Response() + x.status_code=403 + if x.status_code == 200: f.write(x.content) f.close() -- cgit v1.2.3-70-g09d2