From d86bf75315d3a558c90cbcf1c01484b755655c0e Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 4 Sep 2019 14:56:08 +0200 Subject: [PATCH] Add a cause message to the StopBuild exception. --- kiwixbuild/builder.py | 3 ++- kiwixbuild/utils.py | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/kiwixbuild/builder.py b/kiwixbuild/builder.py index 4462fd4..b70c139 100644 --- a/kiwixbuild/builder.py +++ b/kiwixbuild/builder.py @@ -204,6 +204,7 @@ class Builder: platform.clean_intermediate_directories() else: print("SKIP") - except StopBuild: + except StopBuild as e: + print(e) sys.exit("Stopping build due to errors") diff --git a/kiwixbuild/utils.py b/kiwixbuild/utils.py index 0f2844a..9cbd3f3 100644 --- a/kiwixbuild/utils.py +++ b/kiwixbuild/utils.py @@ -127,7 +127,7 @@ def download_remote(what, where): print('Sha256 for {} not set, do no verify download'.format(what.name)) elif what.sha256 != get_sha256(file_path): os.remove(file_path) - raise StopBuild() + raise StopBuild("Sha 256 doesn't correspond") class SkipCommand(Exception): @@ -135,7 +135,11 @@ class SkipCommand(Exception): class StopBuild(Exception): - pass + def __init__(self, msg=""): + self.msg = msg + + def __str__(self): + return self.msg class Remotefile(namedtuple('Remotefile', ('name', 'sha256', 'url'))):