diff options
author | Andrew Laski <andrew.laski@rackspace.com> | 2012-09-07 15:59:42 -0400 |
---|---|---|
committer | Andrew Laski <andrew.laski@rackspace.com> | 2012-09-07 16:04:54 -0400 |
commit | 8cff1a20bc3962ec147f5f7c6807bc4c863eae36 (patch) | |
tree | 42717ea9e7146ddff5f7070a1e927e94b87b2dd4 /novaclient/exceptions.py | |
parent | d6f767f8a3239aa314a9322720d0e543f2e07065 (diff) | |
download | python-novaclient-8cff1a20bc3962ec147f5f7c6807bc4c863eae36.tar.gz |
Add ConnectionRefused exception.
When novaclient gets a Connection Refused it now presents that as a
ConnectionRefused exception with appropriate information rather than as
an HTTP exception. Addresses bug 1047078.
vagrant@precise64:/opt/stack/python-novaclient$ nova image-list
ERROR: ConnectionRefused: '[Errno 111] Connection refused'
Change-Id: Iebf4d78a524004d5e79d2219b35f90fbd38ee690
Diffstat (limited to 'novaclient/exceptions.py')
-rw-r--r-- | novaclient/exceptions.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/novaclient/exceptions.py b/novaclient/exceptions.py index da626921..da6f8d4c 100644 --- a/novaclient/exceptions.py +++ b/novaclient/exceptions.py @@ -51,6 +51,17 @@ class AmbiguousEndpoints(Exception): return "AmbiguousEndpoints: %s" % repr(self.endpoints) +class ConnectionRefused(Exception): + """ + Connection refused: the server refused the connection. + """ + def __init__(self, response=None): + self.response = response + + def __str__(self): + return "ConnectionRefused: %s" % repr(self.response) + + class ClientException(Exception): """ The base exception class for all exceptions this library raises. |