From 4a81a146859cf783c876dc0e8d580333c246596c Mon Sep 17 00:00:00 2001 From: Jamie Lennox Date: Fri, 4 Apr 2014 11:17:24 +1000 Subject: Add new error for invalid response There are a number of places where we expect a certain format of response. If it's not found we often end up raising a KeyError when accessing data. Create a new Exception type that is raised when a HTTP response is not appropriate for parsing and use it within authentication calls. Closes-Bug: #1307306 Change-Id: I3cf2db07a8e76ee17702130e9efb0edf640d293a --- keystoneclient/exceptions.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'keystoneclient/exceptions.py') diff --git a/keystoneclient/exceptions.py b/keystoneclient/exceptions.py index d9d3f38..4572af9 100644 --- a/keystoneclient/exceptions.py +++ b/keystoneclient/exceptions.py @@ -61,3 +61,11 @@ class MissingAuthPlugin(ClientException): class NoMatchingPlugin(ClientException): """There were no auth plugins that could be created from the parameters provided.""" + + +class InvalidResponse(ClientException): + """The response from the server is not valid for this request.""" + + def __init__(self, response): + super(InvalidResponse, self).__init__() + self.response = response -- cgit v1.2.1