Skip to content

Commit

Permalink
propagating file errors upwards to group`
Browse files Browse the repository at this point in the history
  • Loading branch information
matijakolaric committed Dec 19, 2019
1 parent f1e948d commit ef9f7c2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions music_metadata/edi/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def split_into_records(self):
for expected_r_sequence, line in enumerate(
self.lines.strip('\n').split('\n')):
try:
record = self.get_record_class(line[0:3])(line,
expected_r_sequence)
record = self.get_record_class(line[0:3])(
line, expected_r_sequence)
except (RecordError, FileError) as e:
record = EdiRecord(line, expected_r_sequence)
record.error(None, e)
Expand All @@ -50,6 +50,9 @@ def split_into_records(self):
record.validate_sequences(expected_t_sequence, expected_r_sequence)
record.validate()
self.valid &= record.valid
for error in record.errors.values():
if isinstance(error, FileError):
self.errors.append(error)
yield record

def to_dict(self, verbosity=1):
Expand Down

0 comments on commit ef9f7c2

Please sign in to comment.