Use Py3-compatible exception handling

In once case we can completely drop try-except statements: it only
logs the exception details but that will be logged again anyway.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-08-24 14:49:08 +02:00
parent ec39514fba
commit 439a7ce348
3 changed files with 5 additions and 9 deletions

View file

@ -238,11 +238,7 @@ def main():
notifier=notifier)
notifier.compose = compose
COMPOSE = compose
try:
run_compose(compose, create_latest_link=create_latest_link, latest_link_status=latest_link_status)
except Exception, ex:
compose.log_error("Compose run failed: %s" % ex)
raise
run_compose(compose, create_latest_link=create_latest_link, latest_link_status=latest_link_status)
def run_compose(compose, create_latest_link=True, latest_link_status=None):
@ -455,7 +451,7 @@ if __name__ == "__main__":
except (Exception, KeyboardInterrupt) as ex:
if COMPOSE:
tb_path = COMPOSE.paths.log.log_file("global", "traceback")
COMPOSE.log_error("Exception: %s" % ex)
COMPOSE.log_error("Compose run failed: %s" % ex)
COMPOSE.log_error("Extended traceback in: %s" % tb_path)
COMPOSE.log_critical("Compose failed: %s" % COMPOSE.topdir)
COMPOSE.write_status("DOOMED")