Commit 8b12e420 authored by jyasskin@chromium.org's avatar jyasskin@chromium.org

Show the path when a json file fails to parse.

Review URL: https://codereview.chromium.org/132853002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244105 0039d316-1c4b-4281-b951-d872f2087c98
parent 76ccdcd0
......@@ -3,6 +3,7 @@
# found in the LICENSE file.
from collections import defaultdict, Mapping
import traceback
from third_party.json_schema_compiler import json_parse, idl_schema, idl_parser
......@@ -111,7 +112,11 @@ def ProcessSchema(path, file_data):
# Wrap the result in a list so that it behaves like JSON API data.
return [trim_and_inline(idl.process()[0], is_idl=True)]
try:
schemas = json_parse.Parse(file_data)
except:
raise ValueError('Cannot parse "%s" as JSON:\n%s' %
(path, traceback.format_exc()))
for schema in schemas:
# Schemas could consist of one API schema (data for a specific API file)
# or multiple (data from extension_api.json).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment