From f8186c868eba120e8fa87eb8138ffdc52c1dfa16 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Wed, 19 Jan 2022 10:52:34 -0500 Subject: Turn some asserts back into exceptions --- python/basicblock.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'python/basicblock.py') diff --git a/python/basicblock.py b/python/basicblock.py index c73fd604..d504933b 100644 --- a/python/basicblock.py +++ b/python/basicblock.py @@ -223,7 +223,8 @@ class BasicBlock: def _make_edges(self, edges, count:int, direction:bool) -> List[BasicBlockEdge]: assert edges is not None, "Got empty edges list from core" - assert self.view is not None, "Attempting to get BasicBlock edges when BinaryView is None" + if self.view is None: + raise ValueError("Attempting to get BasicBlock edges when BinaryView is None") result:List[BasicBlockEdge] = [] try: for i in range(0, count): @@ -371,9 +372,10 @@ class BasicBlock: @property def annotations(self) -> List[List['_function.InstructionTextToken']]: """List of automatic annotations for the start of this block (read-only)""" - assert self.arch is not None, "attempting to get annotation from BasicBlock without architecture" + if self.arch is None: + raise ValueError("attempting to get annotation from BasicBlock without architecture") if self.function is None: - raise Exception("Attempting to call BasicBlock.annotations when BinaryView is None") + raise ValueError("Attempting to call BasicBlock.annotations when Function is None") return self.function.get_block_annotations(self.start, self.arch) -- cgit v1.3.1