From ecea228c4cefcffce08b5aa10b12cd8a1f20be0e Mon Sep 17 00:00:00 2001 From: gengchc2 Date: Fri, 26 Aug 2016 09:05:46 +0000 Subject: [PATCH] Correct watcher 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: I662583cd3cda2424d5a510cae7e815c97a51c2fe --- watcher/common/exception.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/watcher/common/exception.py b/watcher/common/exception.py index 142941618..16eee46e8 100644 --- a/watcher/common/exception.py +++ b/watcher/common/exception.py @@ -86,7 +86,7 @@ class WatcherException(Exception): if not message: try: message = self.msg_fmt % kwargs - except Exception as e: + except Exception: # kwargs doesn't match a variable in msg_fmt # log the issue and the kwargs LOG.exception(_LE('Exception in string format operation')) @@ -95,7 +95,7 @@ class WatcherException(Exception): {'name': name, 'value': value}) if CONF.fatal_exception_format_errors: - raise e + raise else: # at least get the core msg_fmt out if something happened message = self.msg_fmt