Skip to content

Commit 1ca5f85

Browse files
Save errors per cchfile
1 parent 6cfb8f8 commit 1ca5f85

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cchloader/file.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class CchFile(object):
7777
def __init__(self, path, fd=None, parser=None, strict=False):
7878
self.path = path
7979
self.resume_line_number = 0
80+
self.errors = []
8081
if parser is None:
8182
self.parser = get_parser(self.path)(strict=strict)
8283
else:
@@ -111,13 +112,12 @@ def _bytes_to_unicode(data):
111112
def next(self):
112113
for line in self.fd:
113114
try:
114-
# data, errors = self.parser.parse_line(line)
115115
data, errors = self.parser.parse_line(line)
116116
data = self._bytes_to_unicode(data)
117-
# if errors:
118-
# self.stats.errors.append(
119-
# (self.stats.line_number, errors)
120-
# )
117+
if errors:
118+
for error in errors.items():
119+
if error not in self.errors:
120+
self.errors.append(error)
121121
return data
122122
except Exception as exc:
123123
logger.critical(

0 commit comments

Comments
 (0)