From a9087f026297a9ed0bb5f27c31ce203078d0d6fa Mon Sep 17 00:00:00 2001 From: lefherz Date: Sun, 2 Jun 2019 16:17:57 +0200 Subject: extended MastodonServerError for all 5xx error codes --- mastodon/Mastodon.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 65ce518..bfc2a9b 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -2750,7 +2750,8 @@ class Mastodon: # on any 404 elif response_object.status_code == 401: ex_type = MastodonUnauthorizedError - elif response_object.status_code == 502: + elif response_object.status_code >= 500 and \ + response_object.status_code <= 511: ex_type = MastodonServerError else: ex_type = MastodonAPIError @@ -3068,7 +3069,7 @@ class MastodonAPIError(MastodonError): pass class MastodonServerError(MastodonError): - """Raised if the Server is malconfigured, e.g. returns a 502 error code""" + """Raised if the Server is malconfigured and returns a 5xx error code""" pass class MastodonNotFoundError(MastodonAPIError): -- cgit v1.2.3