add a little bit of error checking
This commit is contained in:
parent
89e03122f7
commit
55e8706f80
13
record.py
13
record.py
|
@ -45,6 +45,7 @@ class RecordCollection():
|
|||
try:
|
||||
current[spl[0]] = spl[1]
|
||||
except IndexError:
|
||||
# TODO: maybe add line numbers?
|
||||
raise FileParsingError(f"error parsing '{i}'")
|
||||
|
||||
else:
|
||||
|
@ -61,9 +62,17 @@ class RecordCollection():
|
|||
for i in self.objects:
|
||||
current = self.objects[i]
|
||||
try:
|
||||
for j, k in zip(
|
||||
current['inherit'].split(' '),
|
||||
inherit = current['inherit'].split(' ')
|
||||
inherit_order = \
|
||||
[int(i) for i in current['inherit_order'].split(' ')]
|
||||
|
||||
# TODO: add more precise error checking
|
||||
if not len(inherit) == len(inherit_order):
|
||||
raise FileParsingError("len(inherit) != len(inherit_order)")
|
||||
|
||||
for j, k in zip(
|
||||
inherit,
|
||||
inherit_order
|
||||
):
|
||||
|
||||
current.parents[j] = self.objects[j]
|
||||
|
|
Loading…
Reference in New Issue