diff --git a/locales/en.json b/locales/en.json index 03ecdbccd..1ad7361e9 100644 --- a/locales/en.json +++ b/locales/en.json @@ -23,7 +23,7 @@ "app_id_invalid": "Invalid app ID", "app_incompatible": "The app {app} is incompatible with your YunoHost version", "app_install_files_invalid": "These files cannot be installed", - "app_install_failed": "Could not install {app}", + "app_install_failed": "Could not install {app}: {error}", "app_install_script_failed": "An error occured inside the app installation script", "app_location_already_used": "The app '{app}' is already installed in ({path})", "app_make_default_location_already_used": "Can't make the app '{app}' the default on the domain, {domain} is already in use by the other app '{other_app}'", diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 9074c90fd..5b7202362 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -994,19 +994,19 @@ def app_install(operation_logger, app, label=None, args=None, no_remove_on_failu install_failed = True if install_retcode != 0 else False if install_failed: error = m18n.n('app_install_script_failed') - logger.exception(error) - operation_logger.error(error) + logger.exception(m18n.n("app_install_failed", app=app_id, error=error)) + failure_message_with_debug_instructions = operation_logger.error(error) # Script got manually interrupted ... N.B. : KeyboardInterrupt does not inherit from Exception except (KeyboardInterrupt, EOFError): error = m18n.n('operation_interrupted') - logger.exception(error) - operation_logger.error(error) + logger.exception(m18n.n("app_install_failed", app=app_id, error=error)) + failure_message_with_debug_instructions = operation_logger.error(error) # Something wrong happened in Yunohost's code (most probably hook_exec) - except Exception as e : + except Exception as e: import traceback error = m18n.n('unexpected_error', error=u"\n" + traceback.format_exc()) - logger.exception(error) - operation_logger.error(error) + logger.exception(m18n.n("app_install_failed", app=app_id, error=error)) + failure_message_with_debug_instructions = operation_logger.error(error) finally: # Whatever happened (install success or failure) we check if it broke the system # and warn the user about it @@ -1015,8 +1015,8 @@ def app_install(operation_logger, app, label=None, args=None, no_remove_on_failu _assert_system_is_sane_for_app(manifest, "post") except Exception as e: broke_the_system = True - logger.exception(str(e)) - operation_logger.error(str(e)) + logger.exception(m18n.n("app_install_failed", app=app_id, error=str(e))) + failure_message_with_debug_instructions = operation_logger.error(str(e)) # If the install failed or broke the system, we remove it if install_failed or broke_the_system: @@ -1076,7 +1076,7 @@ def app_install(operation_logger, app, label=None, args=None, no_remove_on_failu app_ssowatconf() - raise YunohostError("app_install_failed", app=app_id) + raise YunohostError(failure_message_with_debug_instructions, raw_msg=True) # Clean hooks and add new ones hook_remove(app_instance_name)