From 30f4d29d5af88b2606c558e1934195993247a569 Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Sun, 19 Jan 2025 12:27:04 +0100 Subject: [PATCH] feat: raise exceptions for failed mastodon operations --- mastodon.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mastodon.py b/mastodon.py index 2b147c7..e82e465 100644 --- a/mastodon.py +++ b/mastodon.py @@ -15,7 +15,8 @@ def get_account_tagged_statuses(app, tag): exclude_reblogs=True ) except: - print('>>> failed to fetch statuses', tag) + message = f'>>> failed to fetch statuses for ${tag}' + raise Exception(message) return list(map(lambda x: utils.clean_status(x), statuses)) @@ -28,7 +29,8 @@ def initialize_client(app): secret_file = open(app['secret_file'], 'r') secret = secret_file.read() except OSError as e: - print('>>> No secret found.') + message = '>>> No secret found.' + raise Exception(message) # todo, check if access_token exist in secret_file if secret == None: