From c3b1952a79e887a7b486fa4682f19899f78a9769 Mon Sep 17 00:00:00 2001 From: Liam Steckler Date: Wed, 11 Sep 2024 19:16:52 -0700 Subject: [PATCH] Handle replying to aa missing post --- scl.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scl.py b/scl.py index 34f70b3..b009438 100644 --- a/scl.py +++ b/scl.py @@ -373,13 +373,16 @@ with Session(engine) as session: ), ) if max_event_class["is_postable"] and existing_record.initial_post_id: - post_result = mastodon_client.status_post( - status="\n".join(updated_entries), - in_reply_to_id=existing_record.most_recent_post_id, - visibility="unlisted", - language="en", - ) - existing_record.most_recent_post_id = post_result["id"] + try: + post_result = mastodon_client.status_post( + status="\n".join(updated_entries), + in_reply_to_id=existing_record.most_recent_post_id, + visibility="unlisted", + language="en", + ) + existing_record.most_recent_post_id = post_result["id"] + except mastodon.MastodonNotFoundError: + print("Could not post a reply to the existing post, skip this update") elif max_event_class["is_postable"]: print( "Posting an event that grew above the threshold required to post"