summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-09-24 07:45:03 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-09-24 07:46:01 +0200
commit8cdc31723814b8cb447d1ad48191cebf74ea70ac (patch)
tree5ceeeb601c392f75b32fd0d33d4a3e6062b332dc
parent0331ddf28f81d265bbb31fa58e9de9091d2cd904 (diff)
qmi-codegen: fix error reporting when failed parsing JSON
If we get an error parsing a JSON file we really want to have the exact line number where the error happened, so don't just skip the comment lines and substitute them with an empty line instead so that the line numbers don't change.
-rw-r--r--build-aux/qmi-codegen/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/build-aux/qmi-codegen/utils.py b/build-aux/qmi-codegen/utils.py
index a2a94db..4610895 100644
--- a/build-aux/qmi-codegen/utils.py
+++ b/build-aux/qmi-codegen/utils.py
@@ -195,7 +195,9 @@ def read_json_file(path):
stripped = line.strip()
if stripped.startswith('//'):
# Skip this line
- pass
+ # We add an empty line instead so that errors when parsing the JSON
+ # report the proper line number
+ out += "\n"
else:
out += line
return out