Skip to content

Commit

Permalink
Use get method to provide default for error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Leland committed Jan 13, 2017
1 parent f99e3fc commit f343c21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sparkpost/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self, response, *args, **kwargs):
try:
errors = response.json()['errors']
error_template = "{message} Code: {code} Description: {desc} \n"
errors = [error_template.format(message=e['message'],
errors = [error_template.format(message=e.get('message', ''),
code=e.get('code', 'none'),
desc=e.get('description', 'none'))
for e in errors]
Expand Down

0 comments on commit f343c21

Please sign in to comment.