Capitalize SDK more reasonably in an exception name

Change-Id: I0902cfc5f487852cb09f596fe75a8f77807da9e7
This commit is contained in:
Alex Gaynor
2014-06-10 10:22:06 -07:00
parent 5187a750ae
commit 644efad4f9
3 changed files with 14 additions and 14 deletions

View File

@@ -34,14 +34,14 @@ class ServiceFilter(object):
self.service_type = service_type
if not service_type:
msg = "Service type must be specified to locate service"
raise exceptions.SdkException(msg)
raise exceptions.SDKException(msg)
if not visibility:
msg = "Visibility must be specified to locate service"
raise exceptions.SdkException(msg)
raise exceptions.SDKException(msg)
visibility = visibility.rstrip('URL')
if visibility not in self.VISIBILITY:
msg = "Visibility <%s> not in %s" % (visibility, self.VISIBILITY)
raise exceptions.SdkException(msg)
raise exceptions.SDKException(msg)
self.visibility = visibility
self.region = region
self.service_name = service_name

View File

@@ -17,18 +17,18 @@ Exception definitions.
"""
class SdkException(Exception):
class SDKException(Exception):
"""The base exception class for all exceptions this library raises.
"""
pass
class AuthorizationFailure(SdkException):
class AuthorizationFailure(SDKException):
"""Cannot authorize API client."""
pass
class EndpointException(SdkException):
class EndpointException(SDKException):
"""Something is rotten in Service Catalog."""
pass
@@ -43,12 +43,12 @@ class EmptyCatalog(EndpointNotFound):
pass
class NoMatchingPlugin(SdkException):
class NoMatchingPlugin(SDKException):
"""No matching plugins could be created with the provided parameters."""
pass
class InvalidResponse(SdkException):
class InvalidResponse(SDKException):
"""The response from the server is not valid for this request."""
def __init__(self, response):
@@ -56,12 +56,12 @@ class InvalidResponse(SdkException):
self.response = response
class HttpException(SdkException):
class HttpException(SDKException):
def __init__(self, message, details=None):
super(HttpException, self).__init__(message)
self.details = details
class MethodNotSupported(SdkException):
class MethodNotSupported(SDKException):
"""The resource does not support this operation type."""
pass

View File

@@ -48,12 +48,12 @@ class TestServiceFilter(testtools.TestCase):
sot = filt.ServiceFilter('identity', visibility='adminURL')
self.assertEqual("service_type=identity,visibility=admin",
six.text_type(sot))
self.assertRaises(exceptions.SdkException,
self.assertRaises(exceptions.SDKException,
filt.ServiceFilter, 'identity', visibility='b')
self.assertRaises(exceptions.SdkException, filt.ServiceFilter,
self.assertRaises(exceptions.SDKException, filt.ServiceFilter,
'identity', visibility=None)
self.assertRaises(exceptions.SdkException, filt.ServiceFilter, None)
self.assertRaises(exceptions.SdkException, filt.ServiceFilter, None)
self.assertRaises(exceptions.SDKException, filt.ServiceFilter, None)
self.assertRaises(exceptions.SDKException, filt.ServiceFilter, None)
def test_match_service_type(self):
sot = filt.ServiceFilter('identity')