Skip to content

Commit

Permalink
Merge pull request MISP#85 from MISP/errorhandling2
Browse files Browse the repository at this point in the history
Errorhandling2
  • Loading branch information
adulau authored Feb 23, 2017
2 parents 1ef6360 + 9576058 commit 9d388cf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pymisp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,14 @@ def _check_response(self, response):
errors.append(to_return['error'])
else:
errors += to_return['error']
if to_return.get('errors'):
if not isinstance(to_return['errors'], list):
errors.append(to_return['errors'])
else:
errors += to_return['errors']

if 400 <= response.status_code < 500:
if to_return.get('error') is None and to_return.get('message'):
if not errors and to_return.get('message'):
errors.append(to_return['message'])
else:
errors.append(basestring(response.status_code))
Expand Down

0 comments on commit 9d388cf

Please sign in to comment.