Print ERROR: infront of {NonBug,BuildFailed}Error (MR 2298)

Make the handling of the custom NonBugError and BuildFailedError
exceptions more consistent with the handling of other exceptions, by
printing "ERROR: " infront of the actual error text. Then we don't need
to duplicate that where we raise the errors. pmbootstrap prints "ERROR"
in red.
This commit is contained in:
Oliver Smith 2024-04-16 18:05:06 +02:00
parent 888026e95d
commit db163aded6
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
3 changed files with 4 additions and 4 deletions

View File

@ -88,11 +88,11 @@ def main():
sys.exit(130) # SIGINT(2) + 128
except NonBugError as exception:
logging.error(exception)
logging.error(f"ERROR: {exception}")
return 2
except BuildFailedError as exception:
logging.error(exception)
logging.error(f"ERROR: {exception}")
print_log_hint(args)
return 3

View File

@ -535,6 +535,6 @@ def package(args, pkgname, arch=None, force=False, strict=False,
(output, cmd, env) = run_abuild(args, apkbuild, arch, strict, force, cross,
suffix, src, bootstrap_stage)
except RuntimeError:
raise BuildFailedError(f"ERROR: Build for {arch}/{pkgname} failed!")
raise BuildFailedError(f"Build for {arch}/{pkgname} failed!")
finish(args, apkbuild, arch, output, strict, suffix)
return output

View File

@ -272,7 +272,7 @@ def check(args, pkgname, components_list=[], details=False, must_exist=True):
config_name_split = config_name.split(".")
if len(config_name_split) != 2:
raise NonBugError(f"ERROR: {config_name} is not a valid kernel config "
raise NonBugError(f"{config_name} is not a valid kernel config"
"name. Ensure that the _config property in your "
"kernel APKBUILD has a . before the "
"architecture name, e.g. .aarch64 or .armv7, "