From bf76510e8be9bb9e515a76b747c5bb251fec372f Mon Sep 17 00:00:00 2001 From: Maze Date: Sat, 15 Jan 2022 01:35:56 +0100 Subject: [PATCH] Handle when server listing is unavailable This is a bad place to display a huge error because it is a repeating query. And also this is the first thing people see when opening the app for the first time and it is a bad impression. --- src/backend/backend.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/backend.py b/src/backend/backend.py index a568028b..a540326b 100644 --- a/src/backend/backend.py +++ b/src/backend/backend.py @@ -553,7 +553,13 @@ class Backend: ) api_list = "https://publiclist.anchel.nl/publiclist.json" - response = await session.get(api_list) + try: + response = await session.get(api_list) + except: + await session.close() + print("Unable to fetch", api_list) + return + coros = [] for server in (await response.json()):