From 9cc8a2fb00d99703a0c63689aac04fb2c7a7b805 Mon Sep 17 00:00:00 2001 From: bashrc Date: Thu, 15 Jan 2026 13:55:15 +0000 Subject: [PATCH] Exception handling --- posts.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/posts.py b/posts.py index b9930fd9d..8ef043279 100644 --- a/posts.py +++ b/posts.py @@ -5829,15 +5829,26 @@ def archive_posts_for_person(http_prefix: str, nickname: str, domain: str, for ext in extensions: ext_path = file_path.replace('.json', '.' + ext) if os.path.isfile(ext_path): - os.rename(ext_path, + try: + os.rename(ext_path, + archive_path.replace('.json', '.' + ext)) + except OSError: + print('EX: unable to archive file ' + ext_path + + ' -> ' + archive_path.replace('.json', '.' + ext)) - else: - ext_path = file_path.replace('.json', - '.json.' + ext) - if os.path.isfile(ext_path): + continue + ext_path = file_path.replace('.json', '.json.' + ext) + if os.path.isfile(ext_path): + try: os.rename(ext_path, archive_path.replace('.json', '.json.' + ext)) + except OSError: + print('EX: unable to archive file ' + ext_path + + ' -> ' + + archive_path.replace('.json', + '.json.' + ext)) + else: delete_post(base_dir, http_prefix, nickname, domain, file_path, False, recent_posts_cache, False)