Skip to content
Snippets Groups Projects
Commit fa098c97 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: replace asserts with raised errors

parent 3b50909a
No related branches found
No related tags found
2 merge requests!178FIX: #96 Better error output for crawl.py script.,!167Sync Graph
......@@ -301,9 +301,11 @@ class SyncGraph():
equivalent_se = self.get_equivalent(node)
if equivalent_se is not None and equivalent_se is not node:
self._merge_into(node, equivalent_se)
assert equivalent_se.identifiable is not None
if equivalent_se.identifiable is None:
raise ValueError("Identifiable is missing")
else:
assert node.identifiable.get_representation() not in self._identifiable_look_up
if node.identifiable.get_representation() in self._identifiable_look_up:
raise RuntimeError("Identifiable is already in the look up")
self._identifiable_look_up[node.identifiable.get_representation()] = node
@staticmethod
......
......@@ -108,7 +108,10 @@ class SyncNode:
if self.__getattribute__(attr) is None:
self.__setattr__(attr, other.__getattribute__(attr))
else:
assert self.__getattribute__(attr) == other.__getattribute__(attr)
if self.__getattribute__(attr) != other.__getattribute__(attr):
raise ValueError(f"Trying to update {attr} but this would lead to an "
f"override of the value '{self.__getattribute__(attr)}' "
f"by the value '{other.__getattribute__(attr)}'")
for p in other.parents:
if not parent_in_list(p, self.parents):
self.parents.append(p)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment