Skip to content

Commit

Permalink
Improve remote exception printing
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemaeyer committed Feb 29, 2016
1 parent 70601f7 commit 359501b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion shub/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def make_deploy_request(url, data, files, auth, verbose, keep_log):
if rsp.status_code == 403:
raise InvalidAuthException

msg = "Deploy failed ({}):\n{}".format(rsp.status_code, rsp.text)
try:
error = rsp.json()['message']
except (ValueError, TypeError, KeyError):
error = rsp.text
msg = "Deploy failed ({}):\n{}".format(rsp.status_code, error)
raise RemoteErrorException(msg)
except requests.RequestException as exc:
raise RemoteErrorException("Deploy failed: {}".format(exc))
Expand Down

0 comments on commit 359501b

Please sign in to comment.