aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlefherz <[email protected]>2019-06-02 16:17:57 +0200
committerlefherz <[email protected]>2019-06-02 16:17:57 +0200
commita9087f026297a9ed0bb5f27c31ce203078d0d6fa (patch)
tree4c046a8bbf30b9b21ad2f81f5d073a8f21fa03e2
parent6dd18764e39cff0a42aa0f21f88dc1cf4a8e8c63 (diff)
downloadmastodon.py-a9087f026297a9ed0bb5f27c31ce203078d0d6fa.tar.gz
extended MastodonServerError for all 5xx error codes
-rw-r--r--mastodon/Mastodon.py5
1 files changed, 3 insertions, 2 deletions
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:
2750 # on any 404 2750 # on any 404
2751 elif response_object.status_code == 401: 2751 elif response_object.status_code == 401:
2752 ex_type = MastodonUnauthorizedError 2752 ex_type = MastodonUnauthorizedError
2753 elif response_object.status_code == 502: 2753 elif response_object.status_code >= 500 and \
2754 response_object.status_code <= 511:
2754 ex_type = MastodonServerError 2755 ex_type = MastodonServerError
2755 else: 2756 else:
2756 ex_type = MastodonAPIError 2757 ex_type = MastodonAPIError
@@ -3068,7 +3069,7 @@ class MastodonAPIError(MastodonError):
3068 pass 3069 pass
3069 3070
3070class MastodonServerError(MastodonError): 3071class MastodonServerError(MastodonError):
3071 """Raised if the Server is malconfigured, e.g. returns a 502 error code""" 3072 """Raised if the Server is malconfigured and returns a 5xx error code"""
3072 pass 3073 pass
3073 3074
3074class MastodonNotFoundError(MastodonAPIError): 3075class MastodonNotFoundError(MastodonAPIError):
Powered by cgit v1.2.3 (git 2.41.0)