forked from ticketfrei/ticketfrei
don't log Mastodon 502 errors.
This commit is contained in:
parent
02f117a864
commit
11b133f14d
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from bot import Bot
|
from bot import Bot
|
||||||
import logging
|
import logging
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon, MastodonAPIError
|
||||||
import re
|
import re
|
||||||
from report import Report
|
from report import Report
|
||||||
|
|
||||||
|
@ -25,7 +25,13 @@ class MastodonBot(Bot):
|
||||||
return mentions
|
return mentions
|
||||||
try:
|
try:
|
||||||
notifications = m.notifications()
|
notifications = m.notifications()
|
||||||
except Exception:
|
except MastodonAPIError:
|
||||||
|
# Not tested yet, as we don't have a dysfunctional Mastodon instance.
|
||||||
|
for arg in MastodonAPIError.args:
|
||||||
|
if arg == 502:
|
||||||
|
# Don't log 502 errors
|
||||||
|
return mentions
|
||||||
|
|
||||||
logger.error("Unknown Mastodon API Error.", exc_info=True)
|
logger.error("Unknown Mastodon API Error.", exc_info=True)
|
||||||
return mentions
|
return mentions
|
||||||
for status in notifications:
|
for status in notifications:
|
||||||
|
|
Loading…
Reference in a new issue