[util] Better error message for invalid HJSON
If the testplanner comes across invalid HJSON, it only outputs a
stacktrace without the affected file. Change that to make the error
message more human-friendly.
Signed-off-by: Philipp Wagner <phw@lowrisc.org>
diff --git a/util/testplanner/testplan_utils.py b/util/testplanner/testplan_utils.py
index 1f432f9..9ecdf8e 100644
--- a/util/testplanner/testplan_utils.py
+++ b/util/testplanner/testplan_utils.py
@@ -198,6 +198,9 @@
except IOError:
print('IO Error:', filename)
raise SystemExit(sys.exc_info()[1])
+ except hjson.scanner.HjsonDecodeError as e:
+ print("Error: Unable to decode HJSON file %s: %s" % (str(filename), str(e)))
+ sys.exit(1)
def merge_dicts(list1, list2):