From 3dd80833ecbb8b6442fbedd460dc20e4e816f74b Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 22 Nov 2021 16:17:13 -0500 Subject: [PATCH] webhook better error response --- VERSION | 2 +- modules/notifiarr.py | 1 - modules/webhooks.py | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 16ee7b3a..b80328c2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.12.2-develop1115 \ No newline at end of file +1.13.0-develop1122 \ No newline at end of file diff --git a/modules/notifiarr.py b/modules/notifiarr.py index 1c0e8e40..f3f72d2f 100644 --- a/modules/notifiarr.py +++ b/modules/notifiarr.py @@ -28,4 +28,3 @@ class Notifiarr: logger.debug(url.replace(self.apikey, "APIKEY")) params = {"event": "pmm" if self.test else "collections"} return url, params - diff --git a/modules/webhooks.py b/modules/webhooks.py index d0ef40b6..cbe3f47e 100644 --- a/modules/webhooks.py +++ b/modules/webhooks.py @@ -30,6 +30,8 @@ class Webhooks: response_json = response.json() if self.config.trace_mode: logger.debug(f"Response: {response_json}") + if "result" in response_json and response_json["result"] == "error" and "details" in response_json and "response" in response_json["details"]: + raise Failed(f"Notifiarr Error: {response_json['details']['response']}") if response.status_code >= 400 or ("result" in response_json and response_json["result"] == "error"): raise Failed(f"({response.status_code} [{response.reason}]) {response_json}") except JSONDecodeError: