Skip to content

Commit 32c84c3

Browse files
committed
[tools/dict_parser] Continue after sec parse exc
In the DictReader, do not stop and return after a Section.create failed with an Exception, but continue with the next Section in the list.
1 parent bc4cf60 commit 32c84c3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

odml/tools/dict_parser.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,19 +319,17 @@ def parse_sections(self, section_list):
319319

320320
try:
321321
sec = odmlfmt.Section.create(**sec_attrs)
322-
except Exception as exc:
323-
msg = "Section not created (%s)\n %s" % (sec_attrs, str(exc))
324-
self.error(msg)
325-
# If recovered in ignore_error mode, return empty list
326-
return odml_sections
327322

328-
for prop in sec_props:
329-
sec.append(prop)
323+
for prop in sec_props:
324+
sec.append(prop)
330325

331-
for child_sec in children_secs:
332-
sec.append(child_sec)
326+
for child_sec in children_secs:
327+
sec.append(child_sec)
333328

334-
odml_sections.append(sec)
329+
odml_sections.append(sec)
330+
except Exception as exc:
331+
msg = "Section not created (%s)\n %s" % (sec_attrs, str(exc))
332+
self.error(msg)
335333

336334
return odml_sections
337335

0 commit comments

Comments
 (0)