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 <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-08-14 15:03:45 +02:00
parent 143c8c25a9
commit 74ea84f696

View File

@ -808,7 +808,8 @@ def main():
pass pass
except: except:
import traceback import traceback
traceback.print_exc() logger.error(traceback.format_exc().rstrip())
sys.exit(1)
finally: finally:
if tinfoil and (LooseVersion(bb.__version__) > LooseVersion("1.27")): if tinfoil and (LooseVersion(bb.__version__) > LooseVersion("1.27")):
tinfoil.shutdown() tinfoil.shutdown()