From e93fce686e51b14def37cd3002c1be773d2f1cf8 Mon Sep 17 00:00:00 2001 From: Kirill Pushkarev Date: Wed, 20 Dec 2023 16:12:25 +0700 Subject: [PATCH] Improve error reporting format --- pleskdistup/main.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pleskdistup/main.py b/pleskdistup/main.py index 1ce8c94..4fc2638 100644 --- a/pleskdistup/main.py +++ b/pleskdistup/main.py @@ -119,12 +119,18 @@ def required_conditions_satisfied(upgrader: DistUpgrader, options: typing.Any, p return False -def handle_error(error: str, logfile_path: PathType, util_name: str, status_flag_path: PathType) -> None: +def handle_error( + error: str, + logfile_path: PathType, + util_name: str, + status_flag_path: PathType, + upgrader: DistUpgrader, +) -> None: print() print(error) print(messages.FAIL_MESSAGE_HEAD.format(logfile_path=logfile_path), end='') - error_message = f"{util_name} (version {pleskdistup.config.revision}) process has failed. Error: {error}.\n\n" + error_message = f"[{util_name}] (dist-upgrader {pleskdistup.config.revision}, upgrader module {upgrader.upgrader_name} {upgrader.upgrader_version}) process has failed. Error: {error}\n\n" for line in files.get_last_lines(logfile_path, 100): print(line, end='') error_message += line @@ -234,7 +240,7 @@ def do_convert( print(messages.FINISH_RESTART_MESSAGE, end='') systemd.do_reboot() except Exception as e: - handle_error(str(e), logfile_path, util_name, options.status_flag_path) + handle_error(str(e), logfile_path, util_name, options.status_flag_path, upgrader) return 1 else: for stage_id, actions in actions_map.items():