From 6192e85c4e34ccb03ce6b08ffe3618e3e9143630 Mon Sep 17 00:00:00 2001 From: Peter Van Bouwel Date: Wed, 8 Sep 2021 13:35:59 +0200 Subject: [PATCH] When no audit log is available an IndexError is thrown which is not clear for all users. This minor change will raise a runtime error stating that not a single audit log was available in the given time range. --- src/SimpleReplay/extract.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SimpleReplay/extract.py b/src/SimpleReplay/extract.py index c55857cf..fbfe6d69 100644 --- a/src/SimpleReplay/extract.py +++ b/src/SimpleReplay/extract.py @@ -850,9 +850,12 @@ def get_s3_audit_logs( else: curr_index -= 1 - logger.debug( - f'First audit log in start_time range: {audit_objects[curr_index]["Key"].split("/")[-1]}' - ) + try: + logger.debug( + f'First audit log in start_time range: {audit_objects[curr_index]["Key"].split("/")[-1]}' + ) + except IndexError as e: + raise RuntimeError(f"There wasn't a single audit log for the time range {start_time} - {end_time}") from e return (connections, logs, databases, last_connections)