mirror of https://github.com/MISP/PyMISP
Improve errors flattening
parent
cd7f928382
commit
c91849b468
|
@ -185,15 +185,19 @@ class PyMISP(object):
|
||||||
else:
|
else:
|
||||||
messages.append('Error in {}: {}'.format(where, msg))
|
messages.append('Error in {}: {}'.format(where, msg))
|
||||||
else:
|
else:
|
||||||
for e in errors:
|
if isinstance(errors, list):
|
||||||
if not e:
|
for e in errors:
|
||||||
continue
|
if not e:
|
||||||
if isinstance(e, basestring):
|
continue
|
||||||
messages.append(e)
|
if isinstance(e, basestring):
|
||||||
continue
|
messages.append(e)
|
||||||
for type_e, msgs in e.items():
|
continue
|
||||||
for m in msgs:
|
for type_e, msgs in e.items():
|
||||||
messages.append('Error in {}: {}'.format(where, m))
|
for m in msgs:
|
||||||
|
messages.append('Error in {}: {}'.format(where, m))
|
||||||
|
else:
|
||||||
|
messages.append('{} ({})'.format(errors, where))
|
||||||
|
|
||||||
return messages
|
return messages
|
||||||
|
|
||||||
def _check_response(self, response):
|
def _check_response(self, response):
|
||||||
|
|
Loading…
Reference in New Issue