Merge "Make all IPA error classes inherit from RESTError"
This commit is contained in:
commit
69b118aa3f
@ -228,30 +228,34 @@ class VirtualMediaBootError(RESTError):
|
||||
super(VirtualMediaBootError, self).__init__(details)
|
||||
|
||||
|
||||
class ExtensionError(Exception):
|
||||
class ExtensionError(RESTError):
|
||||
pass
|
||||
|
||||
|
||||
class UnknownNodeError(Exception):
|
||||
class UnknownNodeError(RESTError):
|
||||
"""Error raised when the agent is not associated with an Ironic node."""
|
||||
|
||||
message = 'Agent is not associated with an Ironic node.'
|
||||
|
||||
def __init__(self, message=None):
|
||||
if message is not None:
|
||||
self.message = message
|
||||
super(UnknownNodeError, self).__init__(self.message)
|
||||
def __init__(self, details=None):
|
||||
if details is not None:
|
||||
details = details
|
||||
else:
|
||||
details = self.message
|
||||
super(UnknownNodeError, self).__init__(details)
|
||||
|
||||
|
||||
class HardwareManagerNotFound(Exception):
|
||||
class HardwareManagerNotFound(RESTError):
|
||||
"""Error raised when no valid HardwareManager can be found."""
|
||||
|
||||
message = 'No valid HardwareManager found.'
|
||||
|
||||
def __init__(self, message=None):
|
||||
if message is not None:
|
||||
self.message = message
|
||||
super(HardwareManagerNotFound, self).__init__(self.message)
|
||||
def __init__(self, details=None):
|
||||
if details is not None:
|
||||
details = details
|
||||
else:
|
||||
details = self.message
|
||||
super(HardwareManagerNotFound, self).__init__(details)
|
||||
|
||||
|
||||
class HardwareManagerMethodNotFound(RESTError):
|
||||
|
@ -108,6 +108,10 @@ class TestErrors(test_base.BaseTestCase):
|
||||
(errors.BlockDeviceEraseError(DETAILS), SAME_DETAILS),
|
||||
(errors.BlockDeviceError(DETAILS), SAME_DETAILS),
|
||||
(errors.VirtualMediaBootError(DETAILS), SAME_DETAILS),
|
||||
(errors.UnknownNodeError(), SAME_CL_MSG),
|
||||
(errors.UnknownNodeError(DETAILS), SAME_DETAILS),
|
||||
(errors.HardwareManagerNotFound(), SAME_CL_MSG),
|
||||
(errors.HardwareManagerNotFound(DETAILS), SAME_DETAILS),
|
||||
(errors.HardwareManagerMethodNotFound('method'),
|
||||
DIFF_CL_DETAILS),
|
||||
(errors.IncompatibleHardwareMethodError(), SAME_CL_MSG),
|
||||
|
Loading…
x
Reference in New Issue
Block a user