Merge pull request #245 from USA-RedDragon/develop

Fix wrapped JSON Decode error from requests
This commit is contained in:
bobokun 2023-03-29 14:40:59 -04:00 committed by GitHub
commit 6ec5ca9ac2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,7 @@
from json import JSONDecodeError
from requests.exceptions import JSONDecodeError as requestsJSONDecodeError
from modules import util
from modules.util import Failed
@ -70,7 +72,7 @@ class Webhooks:
response.status_code >= 400 or ("result" in response_json and response_json["result"] == "error")
) and skip is False:
raise Failed(f"({response.status_code} [{response.reason}]) {response_json}")
except JSONDecodeError:
except (JSONDecodeError, requestsJSONDecodeError):
if response.status_code >= 400:
raise Failed(f"({response.status_code} [{response.reason}])")