aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodl <[email protected]>2019-03-11 14:51:11 +0100
committercodl <[email protected]>2019-03-11 14:51:11 +0100
commit0666bdabf1c176e9074509f9cb398b4a83b33d2f (patch)
treef3a749fba1a1904c11bbd8f7034ec9488b74299a /mastodon
parent3f83ee0a4ca9d843472f69cbb9a962504950470c (diff)
downloadmastodon.py-0666bdabf1c176e9074509f9cb398b4a83b33d2f.tar.gz
better handling of non-standard error responses, such as from pleroma
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index fc585ba..37e35b7 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -2214,9 +2214,12 @@ class Mastodon:
2214 if not response_object.ok: 2214 if not response_object.ok:
2215 try: 2215 try:
2216 response = response_object.json(object_hook=self.__json_hooks) 2216 response = response_object.json(object_hook=self.__json_hooks)
2217 if not isinstance(response, dict) or 'error' not in response: 2217 if isinstance(response, dict) and 'error' in response:
2218 error_msg = response['error']
2219 elif isinstance(response, str):
2220 error_msg = response
2221 else:
2218 error_msg = None 2222 error_msg = None
2219 error_msg = response['error']
2220 except ValueError: 2223 except ValueError:
2221 error_msg = None 2224 error_msg = None
2222 2225
Powered by cgit v1.2.3 (git 2.41.0)