Correct reraising of exception

when an exception was caught and rethrown, it should call 'raise'
without any arguments because it shows the place where an exception
occured initially instead of place where the exception re-raised.

Change-Id: I76bda89eb37a309a66a68f6d3dea18d51843b83c
This commit is contained in:
Bin Zhou 2016-07-06 16:09:11 +08:00 committed by qinchunhua
parent ddff5978dc
commit 690249b250
3 changed files with 5 additions and 5 deletions

View File

@ -115,14 +115,14 @@ class ImageDataController(object):
try:
image_repo.save(image, from_state='saving')
except exception.NotAuthenticated as e:
except exception.NotAuthenticated:
if refresher is not None:
# request a new token to update an image in database
cxt.auth_token = refresher.refresh_token()
image_repo = self.gateway.get_repo(req.context)
image_repo.save(image, from_state='saving')
else:
raise e
raise
try:
# release resources required for re-auth

View File

@ -268,7 +268,7 @@ def delete(context, name, session):
raise exc.MetadefIntegrityError(
record_type='namespace', record_name=name)
else:
raise e
raise
return namespace_rec.to_dict()
@ -296,6 +296,6 @@ def delete_cascade(context, name, session):
raise exc.MetadefIntegrityError(
record_type='namespace', record_name=name)
else:
raise e
raise
return namespace_rec.to_dict()

View File

@ -102,6 +102,6 @@ def delete(context, name, session):
raise exc.MetadefIntegrityError(
record_type='resource-type', record_name=name)
else:
raise e
raise
return db_rec.to_dict()