scripts: zephyr_flash_debug.py: swallow exceptions by default
For readability, swallow exceptions unless --verbose is given on the
command line. Add a printline to direct the user how to ensure that's
set in case more information out of the flash script is desired.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
diff --git a/scripts/support/zephyr_flash_debug.py b/scripts/support/zephyr_flash_debug.py
index fc28634..c4898e4 100755
--- a/scripts/support/zephyr_flash_debug.py
+++ b/scripts/support/zephyr_flash_debug.py
@@ -91,8 +91,15 @@
try:
handlers[args.top_command](args)
except Exception as e:
- print('Error: {}'.format(e), file=sys.stderr)
- raise
+ if args.verbose:
+ raise
+ else:
+ print('Error: {}'.format(e), file=sys.stderr)
+ print(('(Re-run as "{} --verbose {} ..." '
+ 'or set CMAKE_VERBOSE_MAKEFILE for a stack trace.)').format(
+ sys.argv[0], args.top_command),
+ file=sys.stderr)
+ sys.exit(1)
if __name__ == '__main__':