Skip to content

Commit

Permalink
error showing as None when not present
Browse files Browse the repository at this point in the history
  • Loading branch information
matijakolaric committed Dec 20, 2019
1 parent fec5983 commit 904cb2e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion music_metadata/edi/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ def to_dict(self, record, label=None, verbosity=1):
d['field_mandatory'] = self._mandatory
d['valid'] = valid
if not valid or verbosity > 1:
d['error'] = str(record.errors.get(label))
error = record.errors.get(label)
if error:
d['error'] = str(error)
else:
d['error'] = None
d['value'] = value
return d

Expand Down

0 comments on commit 904cb2e

Please sign in to comment.