diff options
author | Lorenz Diener <[email protected]> | 2019-04-27 17:23:46 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2019-04-27 17:23:46 +0200 |
commit | 351d3025310a85ee9eb1f7d6ab331c3ce5ec8eb4 (patch) | |
tree | dfa0be6919caae6235cd1e6f86348940df55c39b | |
parent | 28ba394cb9f24cc550b33f41b32ebee727b10223 (diff) | |
parent | 280973661d5d5b7528b42252537113435732366c (diff) | |
download | mastodon.py-351d3025310a85ee9eb1f7d6ab331c3ce5ec8eb4.tar.gz |
Merge pull request #158 from lefherz/master
New exception class if server is malconfigured, e.g. 502
-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 98cebab..f55d4bb 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -2245,6 +2245,8 @@ class Mastodon: | |||
2245 | # on any 404 | 2245 | # on any 404 |
2246 | elif response_object.status_code == 401: | 2246 | elif response_object.status_code == 401: |
2247 | ex_type = MastodonUnauthorizedError | 2247 | ex_type = MastodonUnauthorizedError |
2248 | elif response_object.status_code == 502: | ||
2249 | ex_type = MastodonServerError | ||
2248 | else: | 2250 | else: |
2249 | ex_type = MastodonAPIError | 2251 | ex_type = MastodonAPIError |
2250 | 2252 | ||
@@ -2539,6 +2541,10 @@ class MastodonAPIError(MastodonError): | |||
2539 | """Raised when the mastodon API generates a response that cannot be handled""" | 2541 | """Raised when the mastodon API generates a response that cannot be handled""" |
2540 | pass | 2542 | pass |
2541 | 2543 | ||
2544 | class MastodonServerError(MastodonError): | ||
2545 | """Raised if the Server is malconfigured, e.g. returns a 502 error code""" | ||
2546 | pass | ||
2547 | |||
2542 | class MastodonNotFoundError(MastodonAPIError): | 2548 | class MastodonNotFoundError(MastodonAPIError): |
2543 | """Raised when the mastodon API returns a 404 Not Found error""" | 2549 | """Raised when the mastodon API returns a 404 Not Found error""" |
2544 | pass | 2550 | pass |