From 3ee1c03f66e2a586c4d62f90408ed11b531a2433 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Mon, 29 Jul 2024 18:09:20 -0700 Subject: [PATCH] improve error handling --- fatamorgana/main.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fatamorgana/main.py b/fatamorgana/main.py index 74c37aa..d0f5c29 100644 --- a/fatamorgana/main.py +++ b/fatamorgana/main.py @@ -163,11 +163,10 @@ class OasisLayout: """ try: record_id = read_uint(stream) - except EOFError as e: + except EOFError: if file_state.within_cblock: return True - else: - raise e + raise logger.info(f'read_record of type {record_id} at position 0x{stream.tell():x}') @@ -203,7 +202,7 @@ class OasisLayout: file_state.within_cell = False elif record_id in range(15, 28) or record_id in (32, 33): if not file_state.within_cell: - raise Exception('Geometry outside Cell') + raise InvalidRecordError('Geometry outside Cell') elif record_id in (13, 14): file_state.within_cell = True else: