Compare commits

...

2 Commits

Author SHA1 Message Date
b3yond 11b133f14d don't log Mastodon 502 errors. 2019-02-02 22:02:56 +01:00
b3yond 02f117a864
Merge pull request #82 from ticketfrei/csrf
Building in CSRF prevention
2019-01-27 17:56:53 +01:00
1 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,7 @@
from bot import Bot
import logging
from mastodon import Mastodon
from mastodon import Mastodon, MastodonAPIError
import re
from report import Report
@ -25,7 +25,13 @@ class MastodonBot(Bot):
return mentions
try:
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)
return mentions
for status in notifications: