webhook better error response

pull/450/head
meisnate12 3 years ago
parent 7f77a3c838
commit 3dd80833ec

@ -1 +1 @@
1.12.2-develop1115
1.13.0-develop1122

@ -28,4 +28,3 @@ class Notifiarr:
logger.debug(url.replace(self.apikey, "APIKEY"))
params = {"event": "pmm" if self.test else "collections"}
return url, params

@ -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:

Loading…
Cancel
Save