From 694c3ae3dd2b5392d75b67434cbc54c421f68d9f Mon Sep 17 00:00:00 2001 From: Abby Gourlay Date: Wed, 1 Apr 2020 01:18:27 +0100 Subject: [PATCH] Added better error handling to public info check --- jellyfin_kodi/jellyfin/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jellyfin_kodi/jellyfin/api.py b/jellyfin_kodi/jellyfin/api.py index 49000cb3..fafa62be 100644 --- a/jellyfin_kodi/jellyfin/api.py +++ b/jellyfin_kodi/jellyfin/api.py @@ -430,7 +430,12 @@ class API(object): def get_public_info(self, server_address): response = self.send_request(server_address, "system/info/public") - return response.json() if response.status_code == 200 else {} + try: + return response.json() if response.status_code == 200 else {} + except JSONDecodeError as e: + LOG.error("Failed to get server public info. JSON error: %s" % e) + LOG.error(response.content) + return {} def check_redirect(self, server_address): ''' Checks if the server is redirecting traffic to a new URL and