From 4104290d2d61b893688dd099db1d65fb35249c9c Mon Sep 17 00:00:00 2001 From: Andy Lulham Date: Sun, 12 May 2024 22:11:37 +0100 Subject: [PATCH] Raise an exception if no tweets fetched --- x_notes/tweets.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x_notes/tweets.py b/x_notes/tweets.py index 865557cd..6c4e06c1 100644 --- a/x_notes/tweets.py +++ b/x_notes/tweets.py @@ -84,5 +84,8 @@ def get_next_unfetched_note(notes: dict[str, dict[str, Any]]) -> dict[str, Any] for update_note_id in tweets_with_multi_notes.get(note["tweet_id"], [note_id]): notes[update_note_id] = {**note, **note_update} + if total_fetched == 0: + raise Exception("Failed to fetch any tweets") + logger.info(f"Total tweets fetched: {total_fetched}") save_notes(notes)