From 6bac1be5dc9be1ec1ba8d5f79dfff4f12345dd34 Mon Sep 17 00:00:00 2001 From: eli fessler Date: Wed, 31 May 2023 04:38:02 -1000 Subject: [PATCH] catch graphql query errors with a nice message --- s3s.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/s3s.py b/s3s.py index c073b16..03431b3 100755 --- a/s3s.py +++ b/s3s.py @@ -255,6 +255,10 @@ def fetch_json(which, separate=False, exportall=False, specific=False, numbers_o query1_resp = json.loads(query1.text) swim() + if not query1_resp.get("data"): # catch error + print("\nSomething's wrong with one of the query hashes. Ensure s3s is up-to-date, and if this message persists, please open an issue on GitHub.") + sys.exit(1) + # ink battles - latest 50 of any type if "latestBattleHistories" in query1_resp["data"]: for battle_group in query1_resp["data"]["latestBattleHistories"]["historyGroups"]["nodes"]: