From bb1df38caa75d85855062971116002f9e60cec4d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot <groot@kde.org> Date: Mon, 24 May 2021 23:05:46 +0200 Subject: [PATCH] [bootloader] Convert command-failures into readable error messages Avoid leaking errors to the caller, because that gets us a traceback and generic Python Error message, which is less-than-helpful. --- src/modules/bootloader/main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index 03fdb0c5b..3e384a018 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -474,6 +474,14 @@ def run(): libcalamares.utils.warning( "EFI system, but nothing mounted on {!s}".format(efi_system_partition) ) return None - prepare_bootloader(fw_type) + try: + prepare_bootloader(fw_type) + except subprocess.CalledProcessError as e: + libcalamares.utils.warning(str(e)) + libcalamares.utils.debug("stdout:" + str(e.stdout)) + libcalamares.utils.debug("stderr:" + str(e.stderr)) + return (_("Bootloader installation error"), + _("The bootloader could not be installed. The installation command <pre>{!s}</pre> returned error code {!s}.") + .format(e.cmd, e.returncode)) return None