From 6ad3218708581312253c82bb34943cbb4d87a83b Mon Sep 17 00:00:00 2001 From: bobokun Date: Thu, 17 Mar 2022 17:51:01 -0400 Subject: [PATCH] throw proper error when Notifiarr is down --- modules/notifiarr.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/notifiarr.py b/modules/notifiarr.py index e53b84b..3dd143d 100644 --- a/modules/notifiarr.py +++ b/modules/notifiarr.py @@ -18,6 +18,7 @@ class Notifiarr: self.instance = params["instance"] url, _ = self.get_url("user/validate/") response = self.config.get(url) + response_json = None try: response_json = response.json() except JSONDecodeError as e: @@ -26,6 +27,8 @@ class Notifiarr: raise Failed("Notifiarr Error (Response: 525): SSL handshake between Cloudflare and the origin web server failed.") else: raise Failed(e) + if response_json is None: + raise Failed("Notifiarr Error: Unable to connect to Notifiarr. It may be down?") if response.status_code >= 400 or ("result" in response_json and response_json["result"] == "error"): logger.debug(f"Response: {response_json}") raise Failed(f"({response.status_code} [{response.reason}]) {response_json}")