From 1affdcf9af77502fec6a6136e04015bc6586bb66 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Mon, 24 Jun 2024 13:55:22 -0700 Subject: [PATCH] fix: catch error that occurs when ghost usre creates an event. Signed-off-by: Zack Koppert --- time_to_ready_for_review.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/time_to_ready_for_review.py b/time_to_ready_for_review.py index 8c744b1..f95ffc3 100644 --- a/time_to_ready_for_review.py +++ b/time_to_ready_for_review.py @@ -37,8 +37,14 @@ def get_time_to_ready_for_review( return None events = issue.issue.events(number=50) - for event in events: - if event.event == "ready_for_review": - return event.created_at + try: + for event in events: + if event.event == "ready_for_review": + return event.created_at + except TypeError as e: + print( + f"An error occurred processing review events. Perhaps issue contains a ghost user. {e}" + ) + return None return None