From f41609edd76b24d9e0267b31faba796fdc5cbfda Mon Sep 17 00:00:00 2001 From: nanos Date: Wed, 4 Dec 2024 07:30:08 +0000 Subject: [PATCH] improve error message --- find_posts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/find_posts.py b/find_posts.py index 4a44b2f..8a6ed5a 100644 --- a/find_posts.py +++ b/find_posts.py @@ -1442,15 +1442,15 @@ def report_mastodon_error(error_message, error_code, access_token, required_scop subline = "" match error_code: case 401: - subline = "Ensure your access token is correct" + subline = "\nIt looks like your access token is incorrect. Consider generating a new access token, and/or ensure you have copy and pasted the whole token correctly." case 403: if(required_scope != ""): - subline = f"Make sure you have the {required_scope} scope enabled for your access token." + subline = f"\nAdd the {required_scope} scope to your access token, and regenerate the token." else: - subline = "Make sure you have enabled the required scope for your token" + subline = "\nMake sure you have enabled the required scope(s) for your token." raise Exception( - f"{error_message} for token {access_token[:+5] + '*' * (len(access_token) - 10) + access_token[-5:]}. Status code: {error_code} " + f"{error_message} with token {access_token[:+5]}{'*' * (len(access_token) - 10)}{access_token[-5:]}. Status code: {error_code} " f"{subline}" )