fix error detection in mastodon.py

This commit is contained in:
codl 2017-09-17 15:12:01 +02:00
parent 260f15d44a
commit 4b1a6a3a90
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 3 additions and 1 deletions

View File

@ -184,7 +184,9 @@ def refresh_posts(posts):
except (MastodonAPIError, except (MastodonAPIError,
MastodonNetworkError, MastodonNetworkError,
MastodonRatelimitError) as e: MastodonRatelimitError) as e:
if str(e) in ('Endpoint not found.', 'Record not found.'): if any([
err in str(e)
for err in ('Endpoint not found.', 'Record not found.')]):
db.session.delete(post) db.session.delete(post)
else: else:
raise TemporaryError(e) raise TemporaryError(e)