From 4929598d0a962c91c03edc59df6c842c3b7a35d4 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 9 Feb 2023 12:41:31 +0000 Subject: [PATCH] Exception types --- desktop_client.py | 2 +- manualapprove.py | 2 +- webapp_utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/desktop_client.py b/desktop_client.py index f78305bd5..5efee20a4 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -182,7 +182,7 @@ def _mark_post_as_read(actor: str, post_id: str, post_category: str) -> None: if post_id not in content: read_file.seek(0, 0) read_file.write(post_id + content) - except Exception as ex: + except OSError as ex: print('EX: Failed to mark post as read' + str(ex)) else: with open(read_posts_filename, 'w+', encoding='utf-8') as read_file: diff --git a/manualapprove.py b/manualapprove.py index 227da4590..82042b7c8 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -293,7 +293,7 @@ def manual_approve_follow_request(session, session_onion, session_i2p, followers_file.seek(0, 0) followers_file.write(approve_handle_full + '\n' + content) - except Exception as ex: + except OSError as ex: print('WARN: Manual follow accept. ' + 'Failed to write entry to followers file ' + str(ex)) else: diff --git a/webapp_utils.py b/webapp_utils.py index d79e90d9a..22465ec7d 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -1062,7 +1062,7 @@ def load_individual_post_as_html_from_cache(base_dir: str, with open(cached_post_filename, 'r', encoding='utf-8') as file: post_html = file.read() break - except Exception as ex: + except OSError as ex: print('ERROR: load_individual_post_as_html_from_cache ' + str(tries) + ' ' + str(ex)) # no sleep