Fixed shutdowns when Mastodon Errors can't get instance name
parent
6461a011e9
commit
bae6836800
|
@ -26,19 +26,34 @@ class MastodonBot(Bot):
|
|||
try:
|
||||
notifications = m.notifications()
|
||||
except mastodon.MastodonInternalServerError:
|
||||
try:
|
||||
logger.error("Mastodon Error: 500. Server: " + m.instance()['urls']['streaming_api'])
|
||||
except mastodon.MastodonServerError:
|
||||
logger.error("Mastodon Server Error 500, can't get instance.")
|
||||
return mentions
|
||||
except mastodon.MastodonBadGatewayError:
|
||||
try:
|
||||
logger.error("Mastodon Error: 502. Server: " + m.instance()['urls']['streaming_api'])
|
||||
except mastodon.MastodonServerError:
|
||||
logger.error("Mastodon Server Error 502, can't get instance.")
|
||||
return mentions
|
||||
except mastodon.MastodonServiceUnavailableError:
|
||||
try:
|
||||
logger.error("Mastodon Error: 503. Server: " + m.instance()['urls']['streaming_api'])
|
||||
except mastodon.MastodonServerError:
|
||||
logger.error("Mastodon Server Error 503, can't get instance.")
|
||||
return mentions
|
||||
except mastodon.MastodonGatewayTimeoutError:
|
||||
try:
|
||||
logger.error("Mastodon Error: 504. Server: " + m.instance()['urls']['streaming_api'])
|
||||
except mastodon.MastodonServerError:
|
||||
logger.error("Mastodon Server Error 504, can't get instance.")
|
||||
return mentions
|
||||
except mastodon.MastodonServerError:
|
||||
try:
|
||||
logger.error("Unknown Mastodon Server Error. Server: " + m.instance()['urls']['streaming_api'], exc_info=True)
|
||||
except mastodon.MastodonServerError:
|
||||
logger.error("Unknown Mastodon Server Error.", exc_info=True)
|
||||
return mentions
|
||||
for status in notifications:
|
||||
if (status['type'] == 'mention' and
|
||||
|
|
Loading…
Reference in New Issue