cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [2/2] git commit: requester: better requests error handling
Date Fri, 31 Oct 2014 17:37:32 GMT
requester: better requests error handling

Signed-off-by: Rohit Yadav <rohit.yadav@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/master
Commit: 300c47534c29969718024fdbfc26e97f06e8ff2d
Parents: 4031e5e
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Fri Oct 31 22:22:26 2014 +0530
Committer: Rohit Yadav <rohit.yadav@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:


Mime
View raw message