diff options
Diffstat (limited to 'heat')
-rw-r--r-- | heat/common/exception.py | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/heat/common/exception.py b/heat/common/exception.py index 637942486..9b65cd9b6 100644 --- a/heat/common/exception.py +++ b/heat/common/exception.py @@ -46,53 +46,6 @@ class KeystoneError(Exception): return "Code: %s, message: %s" % (self.code, self.message) -def wrap_exception(notifier=None, publisher_id=None, event_type=None, - level=None): - """This decorator wraps a method to catch any exceptions that may - get thrown. It logs the exception as well as optionally sending - it to the notification system. - """ - # TODO(sandy): Find a way to import nova.notifier.api so we don't have - # to pass it in as a parameter. Otherwise we get a cyclic import of - # nova.notifier.api -> nova.utils -> nova.exception :( - # TODO(johannes): Also, it would be nice to use - # utils.save_and_reraise_exception() without an import loop - def inner(f): - def wrapped(*args, **kw): - try: - return f(*args, **kw) - except Exception as e: - # Save exception since it can be clobbered during processing - # below before we can re-raise - exc_info = sys.exc_info() - - if notifier: - payload = dict(args=args, exception=e) - payload.update(kw) - - # Use a temp vars so we don't shadow - # our outer definitions. - temp_level = level - if not temp_level: - temp_level = notifier.ERROR - - temp_type = event_type - if not temp_type: - # If f has multiple decorators, they must use - # six.wraps to ensure the name is - # propagated. - temp_type = f.__name__ - - notifier.notify(publisher_id, temp_type, temp_level, - payload) - - # re-raise original exception since it may have been clobbered - raise_(exc_info[0], exc_info[1], exc_info[2]) - - return six.wraps(f)(wrapped) - return inner - - @six.python_2_unicode_compatible class HeatException(Exception): """Base Heat Exception |