Skip to content

Commit 06d5eea

Browse files
committed
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.
1 parent 9b65b4a commit 06d5eea

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/SimpleReplay/extract.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -850,9 +850,12 @@ def get_s3_audit_logs(
850850
else:
851851
curr_index -= 1
852852

853-
logger.debug(
854-
f'First audit log in start_time range: {audit_objects[curr_index]["Key"].split("/")[-1]}'
855-
)
853+
try:
854+
logger.debug(
855+
f'First audit log in start_time range: {audit_objects[curr_index]["Key"].split("/")[-1]}'
856+
)
857+
except IndexError as e:
858+
raise RuntimeError(f"There wasn't a single audit log for the time range {start_time} - {end_time}") from e
856859
return (connections, logs, databases, last_connections)
857860

858861

0 commit comments

Comments
 (0)