]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
do not if/else format_exc() results 231/head
authorAlfredo Deza <alfredo.deza@inktank.com>
Mon, 18 Aug 2014 20:44:47 +0000 (16:44 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Mon, 18 Aug 2014 20:50:59 +0000 (16:50 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/util/decorators.py

index 7589deb7096c787c944dc99dab93b9651a1d7299..47664e7c8716a40ae8096fc935d95f45d92370b9 100644 (file)
@@ -75,7 +75,7 @@ def catches(catch=None, handler=None, exit=True, handle_all=False):
                     if exit:
                         exit_from_catch = True
                         sys.exit(1)
-            except Exception as err:  # anything else
+            except Exception:  # anything else, no need to save the exception as a variable
                 if handle_all is False:  # re-raise if we are not supposed to handle everything
                     raise
                 # Make sure we don't spit double tracebacks if we are raising
@@ -83,12 +83,9 @@ def catches(catch=None, handler=None, exit=True, handle_all=False):
                 if exit_from_catch:
                     sys.exit(1)
 
-                str_failure = traceback.format_exc(err)
-                if str_failure:
-                    for line in str_failure.split('\n'):
-                        logger.error("%s" % line)
-                else:  # if for whatever reason we can't get an err message
-                    logger.error(make_exception_message(err))
+                str_failure = traceback.format_exc()
+                for line in str_failure.split('\n'):
+                    logger.error("%s" % line)
 
         return newfunc