From 76ef9e03641c7b78a988bb913136a6217d748a01 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Mon, 21 Oct 2019 17:58:43 +0100 Subject: [PATCH] target: Improve error reporting of module installation If an Exception occurs when installing a module log it explicitly to make it clearer to the user what went wrong. --- devlib/target.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/devlib/target.py b/devlib/target.py index 85e7673..94c21d0 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -877,7 +877,11 @@ class Target(object): def _install_module(self, mod, **params): if mod.name not in self._installed_modules: self.logger.debug('Installing module {}'.format(mod.name)) - mod.install(self, **params) + try: + mod.install(self, **params) + except Exception as e: + self.logger.error('Module "{}" failed to install on target'.format(mod.name)) + raise self._installed_modules[mod.name] = mod else: self.logger.debug('Module {} is already installed.'.format(mod.name))