Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
@wraps(f)
def newfunc(*a, **kw):
+ exit_from_catch = False
try:
return f(*a, **kw)
except catch as e:
else:
logger.error(make_exception_message(e))
if exit:
+ exit_from_catch = True
sys.exit(1)
except Exception as err: # anything else
+ # Make sure we don't spit double tracebacks if we are raising
+ # SystemExit from the `except catch` block
+ if exit_from_catch:
+ sys.exit(1)
+
str_failure = traceback.format_exc(err)
if str_failure:
for line in str_failure.split('\n'):