Add exception handling

main
Bob Mottram 2024-02-01 10:58:15 +00:00
parent 9d7170dc93
commit 966ec3389f
1 changed files with 8 additions and 4 deletions

View File

@ -189,10 +189,14 @@ def _mark_post_as_read(actor: str, post_id: str, post_category: str) -> None:
read_file.seek(0, 0)
read_file.write(post_id + content)
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:
read_file.write(post_id + '\n')
print('EX: Failed to mark post as read 1 ' + str(ex))
else
try::
with open(read_posts_filename, 'w+',
encoding='utf-8') as read_file:
read_file.write(post_id + '\n')
except OSError as ex:
print('EX: Failed to mark post as read 2 ' + str(ex))
def _has_read_post(actor: str, post_id: str, post_category: str) -> bool: