more detailed Mastodon 5xx error messages

master
b3yond 2019-07-08 22:33:25 +02:00
parent 2ca213d88a
commit 981b4a787a
1 changed files with 14 additions and 1 deletions

View File

@ -25,9 +25,22 @@ class MastodonBot(Bot):
return mentions
try:
notifications = m.notifications()
except mastodon.MastodonServerError:
logger.error(m.instance()['urls']['streaming_api'])
except mastodon.MastodonInternalServerError:
logger.error("Unknown Mastodon API Error: 500. Server: " + m.instance()['urls'])
return mentions
except mastodon.MastodonBadGatewayError:
logger.error("Unknown Mastodon API Error: 502")
return mentions
except mastodon.MastodonServiceUnavailableError:
logger.error("Unknown Mastodon API Error: 503")
return mentions
except mastodon.MastodonGatewayTimeoutError:
logger.error("Unknown Mastodon API Error: 504")
return mentions
except mastodon.MastodonServerError:
logger.error("Unknown Mastodon Server Error")
return mentions
for status in notifications:
if (status['type'] == 'mention' and
not user.toot_is_seen(status['status']['uri'])):