this repo has no description

Handle deleted posts gracefully in thread fetching

+16 -5
+16 -5
bsky.py
··· 102 102 author_name = notification_data.author.display_name or author_handle 103 103 104 104 # Retrieve the entire thread associated with the mention 105 - thread = atproto_client.app.bsky.feed.get_post_thread({ 106 - 'uri': uri, 107 - 'parent_height': 80, 108 - 'depth': 10 109 - }) 105 + try: 106 + thread = atproto_client.app.bsky.feed.get_post_thread({ 107 + 'uri': uri, 108 + 'parent_height': 80, 109 + 'depth': 10 110 + }) 111 + except Exception as e: 112 + error_str = str(e) 113 + # Check if this is a NotFound error 114 + if 'NotFound' in error_str or 'Post not found' in error_str: 115 + logger.warning(f"Post not found for URI {uri}, removing from queue") 116 + return True # Return True to remove from queue 117 + else: 118 + # Re-raise other errors 119 + logger.error(f"Error fetching thread: {e}") 120 + raise 110 121 111 122 # Get thread context as YAML string 112 123 thread_context = thread_to_yaml_string(thread)