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:
|
try:
|
||||||
current[spl[0]] = spl[1]
|
current[spl[0]] = spl[1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
# TODO: maybe add line numbers?
|
||||||
raise FileParsingError(f"error parsing '{i}'")
|
raise FileParsingError(f"error parsing '{i}'")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -61,9 +62,17 @@ class RecordCollection():
|
||||||
for i in self.objects:
|
for i in self.objects:
|
||||||
current = self.objects[i]
|
current = self.objects[i]
|
||||||
try:
|
try:
|
||||||
for j, k in zip(
|
inherit = current['inherit'].split(' ')
|
||||||
current['inherit'].split(' '),
|
inherit_order = \
|
||||||
[int(i) for i in current['inherit_order'].split(' ')]
|
[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]
|
current.parents[j] = self.objects[j]
|
||||||
|
|
Loading…
Reference in New Issue