Repository: cloudstack-cloudmonkey Updated Branches: refs/heads/5.3 4031e5efe -> 300c47534
requester: better requests error handling Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com> Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/300c4753 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/300c4753 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/300c4753 Branch: refs/heads/5.3 Commit: 300c47534c29969718024fdbfc26e97f06e8ff2d Parents: 4031e5e Author: Rohit Yadav <rohit.ya...@shapeblue.com> Authored: Fri Oct 31 22:22:26 2014 +0530 Committer: Rohit Yadav <rohit.ya...@shapeblue.com> Committed: Fri Oct 31 23:06:34 2014 +0530 ---------------------------------------------------------------------- cloudmonkey/requester.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/300c4753/cloudmonkey/requester.py ---------------------------------------------------------------------- diff --git a/cloudmonkey/requester.py b/cloudmonkey/requester.py index 63f753c..3c06250 100644 --- a/cloudmonkey/requester.py +++ b/cloudmonkey/requester.py @@ -203,8 +203,10 @@ def make_request(command, args, logger, url, credentials, expires): elif response.status_code != 200 and response.status_code != 401: error = "{0}: {1}".format(response.status_code, response.headers.get('X-Description')) + except requests.exceptions.ConnectionError, e: + return None, "Connection refused by server: %s" % e except Exception, pokemon: - error = unicode(pokemon) + error = pokemon.message logger_debug(logger, "Response received: %s" % result) if error is not None: