From 74ea84f6963bf6b730842d01b41ed0b5193e292b Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Tue, 14 Aug 2018 15:03:45 +0200 Subject: [PATCH] update_layer: improve exception handling When an exception occurs during the main part of update_layer, we were catching and printing it but that's not enough - we need to do the following as well: * Use logger.error() to print the exception information, so that it gets logged and highlighted as an error in the layer update * Exit with a non-zero return code so that update.py knows it has failed Signed-off-by: Paul Eggleton --- layerindex/update_layer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py index 2b39e8e..d9c9336 100644 --- a/layerindex/update_layer.py +++ b/layerindex/update_layer.py @@ -808,7 +808,8 @@ def main(): pass except: import traceback - traceback.print_exc() + logger.error(traceback.format_exc().rstrip()) + sys.exit(1) finally: if tinfoil and (LooseVersion(bb.__version__) > LooseVersion("1.27")): tinfoil.shutdown()