Skip to content

Commit 88eddfa

Browse files
kai5263499richleland
authored andcommitted
add extended error code to exception
1 parent b3262a5 commit 88eddfa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sparkpost/exceptions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ def __init__(self, response, *args, **kwargs):
88
errors = None
99
try:
1010
errors = response.json()['errors']
11-
errors = [e['message'] + ': ' + e.get('description', '')
11+
errors = [e['message'] +
12+
' Code: ' + e.get('code', '') +
13+
' Description: ' + e.get('description', '') +
14+
'\n'
1215
for e in errors]
1316
except:
1417
pass
@@ -20,6 +23,7 @@ def __init__(self, response, *args, **kwargs):
2023
message = """Call to {uri} returned {status_code}, errors:
2124
2225
{errors}
26+
2327
""".format(
2428
uri=response.url,
2529
status_code=response.status_code,

0 commit comments

Comments
 (0)