aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-04-27 17:23:46 +0200
committerGitHub <[email protected]>2019-04-27 17:23:46 +0200
commit351d3025310a85ee9eb1f7d6ab331c3ce5ec8eb4 (patch)
treedfa0be6919caae6235cd1e6f86348940df55c39b /mastodon/Mastodon.py
parent28ba394cb9f24cc550b33f41b32ebee727b10223 (diff)
parent280973661d5d5b7528b42252537113435732366c (diff)
downloadmastodon.py-351d3025310a85ee9eb1f7d6ab331c3ce5ec8eb4.tar.gz
Merge pull request #158 from lefherz/master
New exception class if server is malconfigured, e.g. 502
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r--mastodon/Mastodon.py6
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
2544class MastodonServerError(MastodonError):
2545 """Raised if the Server is malconfigured, e.g. returns a 502 error code"""
2546 pass
2547
2542class MastodonNotFoundError(MastodonAPIError): 2548class 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
Powered by cgit v1.2.3 (git 2.41.0)