Remove out-dated exceptions
There are some exceptions defined in exc module, which is introduced two years ago, and it is marked as DEPRECATED in the same time. It should be removed for now, since there are no longer used. Change-Id: I039575f37b0e6d1c30e447b74d61b8cd0b6bbd29
This commit is contained in:
@@ -35,11 +35,7 @@ class CommunicationError(BaseException):
|
||||
"""Unable to communicate with server."""
|
||||
|
||||
|
||||
class ClientException(Exception):
|
||||
"""DEPRECATED."""
|
||||
|
||||
|
||||
class HTTPException(ClientException):
|
||||
class HTTPException(BaseException):
|
||||
"""Base exception for all HTTP-derived exceptions."""
|
||||
code = 'N/A'
|
||||
|
||||
@@ -68,38 +64,18 @@ class HTTPMultipleChoices(HTTPException):
|
||||
self.details)
|
||||
|
||||
|
||||
class BadRequest(HTTPException):
|
||||
"""DEPRECATED."""
|
||||
code = 400
|
||||
|
||||
|
||||
class HTTPBadRequest(HTTPException):
|
||||
code = 400
|
||||
|
||||
|
||||
class Unauthorized(HTTPException):
|
||||
"""DEPRECATED."""
|
||||
code = 401
|
||||
|
||||
|
||||
class HTTPUnauthorized(HTTPException):
|
||||
code = 401
|
||||
|
||||
|
||||
class Forbidden(HTTPException):
|
||||
"""DEPRECATED."""
|
||||
code = 403
|
||||
|
||||
|
||||
class HTTPForbidden(HTTPException):
|
||||
code = 403
|
||||
|
||||
|
||||
class NotFound(HTTPException):
|
||||
"""DEPRECATED."""
|
||||
code = 404
|
||||
|
||||
|
||||
class HTTPNotFound(HTTPException):
|
||||
code = 404
|
||||
|
||||
@@ -108,20 +84,10 @@ class HTTPMethodNotAllowed(HTTPException):
|
||||
code = 405
|
||||
|
||||
|
||||
class Conflict(HTTPException):
|
||||
"""DEPRECATED."""
|
||||
code = 409
|
||||
|
||||
|
||||
class HTTPConflict(HTTPException):
|
||||
code = 409
|
||||
|
||||
|
||||
class OverLimit(HTTPException):
|
||||
"""DEPRECATED."""
|
||||
code = 413
|
||||
|
||||
|
||||
class HTTPOverLimit(HTTPException):
|
||||
code = 413
|
||||
|
||||
@@ -138,11 +104,6 @@ class HTTPBadGateway(HTTPException):
|
||||
code = 502
|
||||
|
||||
|
||||
class ServiceUnavailable(HTTPException):
|
||||
"""DEPRECATED."""
|
||||
code = 503
|
||||
|
||||
|
||||
class HTTPServiceUnavailable(HTTPException):
|
||||
code = 503
|
||||
|
||||
@@ -160,13 +121,3 @@ def from_response(response, details=None):
|
||||
"""Return an instance of an HTTPException based on httplib response."""
|
||||
cls = _code_map.get(response.status, HTTPException)
|
||||
return cls(details)
|
||||
|
||||
|
||||
class NoTokenLookupException(Exception):
|
||||
"""DEPRECATED."""
|
||||
pass
|
||||
|
||||
|
||||
class EndpointNotFound(Exception):
|
||||
"""DEPRECATED."""
|
||||
pass
|
||||
|
||||
@@ -97,10 +97,10 @@ class ShellTest(utils.BaseTestCase):
|
||||
|
||||
@mock.patch.object(ksclient, 'Client')
|
||||
def test_debug_switch_raises_error(self, mock_ksclient):
|
||||
mock_ksclient.side_effect = exc.Unauthorized
|
||||
mock_ksclient.side_effect = exc.HTTPUnauthorized
|
||||
self.make_env()
|
||||
args = ['--debug', 'event-list']
|
||||
self.assertRaises(exc.Unauthorized, ceilometer_shell.main, args)
|
||||
self.assertRaises(exc.HTTPUnauthorized, ceilometer_shell.main, args)
|
||||
|
||||
@mock.patch.object(ksclient, 'Client')
|
||||
def test_dash_d_switch_raises_error(self, mock_ksclient):
|
||||
@@ -111,7 +111,7 @@ class ShellTest(utils.BaseTestCase):
|
||||
|
||||
@mock.patch.object(ksclient, 'Client')
|
||||
def test_no_debug_switch_no_raises_errors(self, mock_ksclient):
|
||||
mock_ksclient.side_effect = exc.Unauthorized("FAIL")
|
||||
mock_ksclient.side_effect = exc.HTTPUnauthorized("FAIL")
|
||||
self.make_env()
|
||||
args = ['event-list']
|
||||
self.assertRaises(SystemExit, ceilometer_shell.main, args)
|
||||
|
||||
Reference in New Issue
Block a user