From 22b185172f0deaf5ce8cad175f635d5bf8d90e84 Mon Sep 17 00:00:00 2001 From: nanos Date: Sun, 30 Apr 2023 16:54:13 +0100 Subject: [PATCH] log info on failure (#44) --- find_posts.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/find_posts.py b/find_posts.py index 2045720..b19add3 100644 --- a/find_posts.py +++ b/find_posts.py @@ -72,13 +72,18 @@ def add_user_posts(server, access_token, followings, know_followings, all_known_ count = 0 failed = 0 for post in posts: - if post['reblog'] == None and post['url'] != None and post['url'] not in seen_urls: - added = add_post_with_context(post, server, access_token, seen_urls) - if added is True: - seen_urls.add(post['url']) - count += 1 - else: - failed += 1 + try: + if post['reblog'] == None and post['url'] != None and post['url'] not in seen_urls: + added = add_post_with_context(post, server, access_token, seen_urls) + if added is True: + seen_urls.add(post['url']) + count += 1 + else: + failed += 1 + except Exception as ex: + log(f"Error adding post {post}") + raise + log(f"Added {count} posts for user {user['acct']} with {failed} errors") if failed == 0: know_followings.add(user['acct'])