Merge "Fix uncaught NotFound exceptions"

This commit is contained in:
Jenkins 2016-05-12 14:29:17 +00:00 committed by Gerrit Code Review
commit 73868becf3
3 changed files with 4 additions and 6 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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'])