mirror of https://github.com/zulip/zulip.git
register_server: Improve HTTP error reporting.
This commit is contained in:
parent
fb09c18462
commit
367fed89f2
|
@ -118,8 +118,13 @@ class Command(ZulipBaseCommand):
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
except requests.HTTPError:
|
except requests.HTTPError as e:
|
||||||
content_dict = response.json()
|
# Report nice errors from the Zulip API if possible.
|
||||||
|
try:
|
||||||
|
content_dict = response.json()
|
||||||
|
except Exception:
|
||||||
|
raise e
|
||||||
|
|
||||||
raise CommandError("Error: " + content_dict["msg"])
|
raise CommandError("Error: " + content_dict["msg"])
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in New Issue