From 47f31b63cee06517cc5f75497cc9e9ac2f1275ed Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Tue, 27 Jan 2015 08:15:42 -0500 Subject: [PATCH] Update apiclient.exceptions oslo-incubator module Changes - * Prefer delayed %r formatting over explicit repr use * Add ConnectionError exception Change-Id: Ibec7dd2713f5f964407acdffa684cb6e9c874c88 --- saharaclient/openstack/common/apiclient/exceptions.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/saharaclient/openstack/common/apiclient/exceptions.py b/saharaclient/openstack/common/apiclient/exceptions.py index 6e9c9763..ce1c53bd 100644 --- a/saharaclient/openstack/common/apiclient/exceptions.py +++ b/saharaclient/openstack/common/apiclient/exceptions.py @@ -67,11 +67,16 @@ class AuthorizationFailure(ClientException): pass -class ConnectionRefused(ClientException): +class ConnectionError(ClientException): """Cannot connect to API service.""" pass +class ConnectionRefused(ConnectionError): + """Connection refused while trying to connect to API service.""" + pass + + class AuthPluginOptionsMissing(AuthorizationFailure): """Auth plugin misses some options.""" def __init__(self, opt_names): @@ -85,7 +90,7 @@ class AuthSystemNotFound(AuthorizationFailure): """User has specified an AuthSystem that is not installed.""" def __init__(self, auth_system): super(AuthSystemNotFound, self).__init__( - _("AuthSystemNotFound: %s") % repr(auth_system)) + _("AuthSystemNotFound: %r") % auth_system) self.auth_system = auth_system @@ -108,7 +113,7 @@ class AmbiguousEndpoints(EndpointException): """Found more than one matching endpoint in Service Catalog.""" def __init__(self, endpoints=None): super(AmbiguousEndpoints, self).__init__( - _("AmbiguousEndpoints: %s") % repr(endpoints)) + _("AmbiguousEndpoints: %r") % endpoints) self.endpoints = endpoints