mirror of https://github.com/MISP/PyMISP
Fix error flattening
parent
5bf6f52301
commit
aaaab590f5
|
@ -166,10 +166,17 @@ class PyMISP(object):
|
||||||
elif response.get('errors'):
|
elif response.get('errors'):
|
||||||
if isinstance(response['errors'], dict):
|
if isinstance(response['errors'], dict):
|
||||||
for where, errors in response['errors'].items():
|
for where, errors in response['errors'].items():
|
||||||
for e in errors:
|
if isinstance(errors, dict):
|
||||||
for type_e, msgs in e.items():
|
for where, msg in errors.items():
|
||||||
for m in msgs:
|
messages.append('Error in {}: {}'.format(where, msg))
|
||||||
messages.append('Error in {}: {}'.format(where, m))
|
else:
|
||||||
|
for e in errors:
|
||||||
|
if isinstance(e, str):
|
||||||
|
messages.append(e)
|
||||||
|
continue
|
||||||
|
for type_e, msgs in e.items():
|
||||||
|
for m in msgs:
|
||||||
|
messages.append('Error in {}: {}'.format(where, m))
|
||||||
return messages
|
return messages
|
||||||
|
|
||||||
def _check_response(self, response):
|
def _check_response(self, response):
|
||||||
|
|
Loading…
Reference in New Issue