Correct reraising of exception

when an exception was caught and rethrown, it should call 'raise'
without any arguments.

Change-Id: Ie7905e47e91547601ae78abf3a6e135a0f8ac2d6
This commit is contained in:
Bin Zhou 2016-07-07 20:20:56 +08:00
parent 592cf2ec28
commit 26fb788b47
2 changed files with 6 additions and 6 deletions

View File

@ -49,13 +49,13 @@ class KeystoneEventConsumer(resources.BaseTask):
self.db_start()
super(KeystoneEventConsumer, self).process(*args, **kwargs)
self.db_commit()
except Exception as e:
except Exception:
"""Exceptions that reach here needs to revert the entire
transaction.
No need to log error message as its already done earlier.
"""
self.db_rollback()
raise e
raise
finally:
self.db_clear()

View File

@ -91,11 +91,11 @@ class BaseTask(object):
# Retrieve the target entity (such as an models.Order instance).
try:
entity = self.retrieve_entity(*args, **kwargs)
except Exception as e:
except Exception:
# Serious error!
LOG.exception(u._LE("Could not retrieve information needed to "
"process task '%s'."), name)
raise e
raise
# Process the target entity.
try:
@ -119,10 +119,10 @@ class BaseTask(object):
# Handle successful conclusion of processing.
try:
self.handle_success(entity, result, *args, **kwargs)
except Exception as e:
except Exception:
LOG.exception(u._LE("Could not process after successfully "
"executing task '%s'."), name)
raise e
raise
return result