We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8fe7c84 commit f99e3fcCopy full SHA for f99e3fc
sparkpost/exceptions.py
@@ -5,15 +5,14 @@ class SparkPostException(Exception):
5
class SparkPostAPIException(SparkPostException):
6
"Handle 4xx and 5xx errors from the SparkPost API"
7
def __init__(self, response, *args, **kwargs):
8
- errors = None
9
try:
10
errors = response.json()['errors']
11
error_template = "{message} Code: {code} Description: {desc} \n"
12
errors = [error_template.format(message=e['message'],
13
code=e.get('code', 'none'),
14
desc=e.get('description', 'none'))
15
for e in errors]
16
- except ValueError:
+ except:
17
errors = [response.text or ""]
18
self.status = response.status_code
19
self.response = response
0 commit comments