Merge "Fix uncaught NotFound exceptions"
This commit is contained in:
commit
73868becf3
cinder
@ -595,7 +595,7 @@ class ResourceExceptionHandler(object):
|
||||
raise Fault(webob.exc.HTTPForbidden(explanation=msg))
|
||||
elif isinstance(ex_value, exception.VersionNotFoundForAPIMethod):
|
||||
raise
|
||||
elif isinstance(ex_value, exception.Invalid):
|
||||
elif isinstance(ex_value, (exception.Invalid, exception.NotFound)):
|
||||
raise Fault(exception.ConvertedException(
|
||||
code=ex_value.code, explanation=six.text_type(ex_value)))
|
||||
elif isinstance(ex_value, TypeError):
|
||||
|
@ -112,8 +112,7 @@ class VolumeEncryptionMetadataTest(test.TestCase):
|
||||
|
||||
res_dict = jsonutils.loads(res.body)
|
||||
expected = {'itemNotFound': {'code': 404,
|
||||
'message': 'VolumeNotFound: Volume '
|
||||
'%s could not be found.'
|
||||
'message': 'Volume %s could not be found.'
|
||||
% bad_volume_id}}
|
||||
self.assertEqual(expected, res_dict)
|
||||
|
||||
@ -168,8 +167,7 @@ class VolumeEncryptionMetadataTest(test.TestCase):
|
||||
|
||||
res_dict = jsonutils.loads(res.body)
|
||||
expected = {'itemNotFound': {'code': 404,
|
||||
'message': 'VolumeNotFound: Volume '
|
||||
'%s could not be found.'
|
||||
'message': 'Volume %s could not be found.'
|
||||
% bad_volume_id}}
|
||||
self.assertEqual(expected, res_dict)
|
||||
|
||||
|
@ -430,7 +430,7 @@ class VolumeTransferAPITestCase(test.TestCase):
|
||||
|
||||
self.assertEqual(404, res.status_int)
|
||||
self.assertEqual(404, res_dict['itemNotFound']['code'])
|
||||
self.assertEqual('TransferNotFound: Transfer %s could not be found.' %
|
||||
self.assertEqual('Transfer %s could not be found.' %
|
||||
fake.WILL_NOT_BE_FOUND_ID,
|
||||
res_dict['itemNotFound']['message'])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user