diff options
author | lefherz <[email protected]> | 2019-02-03 01:58:40 +0100 |
---|---|---|
committer | lefherz <[email protected]> | 2019-02-03 01:58:59 +0100 |
commit | 280973661d5d5b7528b42252537113435732366c (patch) | |
tree | 17e9b15958f3e8af6f163e6d3b6ed65e80d97e53 /mastodon | |
parent | 8b8626978752baf14347498640b2319db832145e (diff) | |
download | mastodon.py-280973661d5d5b7528b42252537113435732366c.tar.gz |
New exception class if server is malconfigured, e.g. 502
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index fc585ba..27c98af 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -2242,6 +2242,8 @@ class Mastodon: | |||
2242 | # on any 404 | 2242 | # on any 404 |
2243 | elif response_object.status_code == 401: | 2243 | elif response_object.status_code == 401: |
2244 | ex_type = MastodonUnauthorizedError | 2244 | ex_type = MastodonUnauthorizedError |
2245 | elif response_object.status_code == 502: | ||
2246 | ex_type = MastodonServerError | ||
2245 | else: | 2247 | else: |
2246 | ex_type = MastodonAPIError | 2248 | ex_type = MastodonAPIError |
2247 | 2249 | ||
@@ -2528,6 +2530,10 @@ class MastodonAPIError(MastodonError): | |||
2528 | """Raised when the mastodon API generates a response that cannot be handled""" | 2530 | """Raised when the mastodon API generates a response that cannot be handled""" |
2529 | pass | 2531 | pass |
2530 | 2532 | ||
2533 | class MastodonServerError(MastodonError): | ||
2534 | """Raised if the Server is malconfigured, e.g. returns a 502 error code""" | ||
2535 | pass | ||
2536 | |||
2531 | class MastodonNotFoundError(MastodonAPIError): | 2537 | class MastodonNotFoundError(MastodonAPIError): |
2532 | """Raised when the mastodon API returns a 404 Not Found error""" | 2538 | """Raised when the mastodon API returns a 404 Not Found error""" |
2533 | pass | 2539 | pass |