scripts: runners: improve error handling CLI

Catch RuntimeError when calling runner.run() and print a message
instead of dumping stack unless in verbose mode.

This improves the command line interface when runners raise exceptions.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-01-09 14:20:34 -08:00 committed by Anas Nashif
commit 8837469492

View file

@ -295,6 +295,12 @@ def do_run_common(command, args, runner_args, cached_runner_var):
except MissingProgram as e:
log.die('required program', e.filename,
'not found; install it or add its location to PATH')
except RuntimeError as re:
if not args.verbose:
log.die(re)
else:
log.err('verbose mode enabled, dumping stack:', fatal=True)
raise
#