mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Add log for Mastodon internal server error (500)
This commit is contained in:
parent
365467166a
commit
123bf33faf
8
twoot.py
8
twoot.py
|
@ -434,8 +434,12 @@ def main(argv):
|
|||
toot = mastodon.status_post(tweet['tweet_text'], replied_to_toot, media_ids=media_ids)
|
||||
|
||||
except MastodonAPIError as e:
|
||||
_, _, _, exception_message = e.args
|
||||
if exception_message.find('Text character limit') != -1:
|
||||
_, status_code, _, exception_message = e.args
|
||||
if status_code == 500:
|
||||
logging.error('Mastodon internal server error')
|
||||
logging.error('posting ' + tweet['tweet_id'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
||||
continue
|
||||
elif exception_message.find('Text character limit') != -1:
|
||||
# ERROR (('Mastodon API returned error', 422, 'Unprocessable Entity', 'Validation failed: Text character limit of 500 exceeded'))
|
||||
logging.error('Toot text too long: %s characters', str(len(tweet['tweet_text'])))
|
||||
logging.error('posting ' + tweet['tweet_id'] + ' to ' + TOML['config']['mastodon_instance'] + ' Failed')
|
||||
|
|
Loading…
Reference in New Issue
Block a user