Show trigger not enabled error in debug only

This commit is contained in:
bobokun 2021-12-19 09:14:53 -05:00
parent 6799d4db8b
commit 2eba2bc94d
No known key found for this signature in database
GPG key ID: 9665BA6CF5DC2671

View file

@ -41,13 +41,19 @@ class Webhooks:
response = self.config.post(f"{self.apprise.api_url}/notify", json=json)
else:
response = self.config.post(webhook, json=json)
skip = False
try:
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"):
if ('trigger is not enabled' in response_json['details']['response']):
logger.debug(f"Notifiarr Warning: {response_json['details']['response']}")
skip = True
else:
raise Failed(f"Notifiarr Error: {response_json['details']['response']}")
if (response.status_code >= 400 or ("result" in response_json and response_json["result"] == "error")) and skip == False:
raise Failed(f"({response.status_code} [{response.reason}]) {response_json}")
except JSONDecodeError:
if response.status_code >= 400: