From 81051f166b06b556c10e01c59e7157d6178f851d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sun, 20 Jul 2014 18:19:02 +0200 Subject: [PATCH] [enh] Catch all exceptions while executing app install script --- app.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index ac1133a68..10eeed558 100644 --- a/app.py +++ b/app.py @@ -482,16 +482,24 @@ def app_install(auth, app, label=None, args=None): app_ssowatconf(auth) msignals.display(m18n.n('installation_complete'), 'success') else: - #TODO: display script fail messages - hook_remove(app_id) - shutil.rmtree(app_setting_path) - shutil.rmtree(app_tmp_folder) raise MoulinetteError(errno.EIO, m18n.n('installation_failed')) - except KeyboardInterrupt, EOFError: + except: + # Execute remove script and clean folders hook_remove(app_id) shutil.rmtree(app_setting_path) shutil.rmtree(app_tmp_folder) - raise MoulinetteError(errno.EINTR, m18n.g('operation_interrupted')) + + # Reraise proper exception + try: + raise + except MoulinetteError: + raise + except KeyboardInterrupt, EOFError: + raise MoulinetteError(errno.EINTR, m18n.g('operation_interrupted')) + except Exception as e: + import traceback + msignals.display(traceback.format_exc(), 'log') + raise MoulinetteError(errno.EIO, m18n.n('installation_failed')) def app_remove(auth, app):