Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4190)

Unified Diff: chrome/common/extensions/docs/server2/schema_util.py

Issue 132853002: Show the path when a json file fails to parse. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server2/schema_util.py
diff --git a/chrome/common/extensions/docs/server2/schema_util.py b/chrome/common/extensions/docs/server2/schema_util.py
index e9752e5ee8f314e2b91c01931e4ce0473346d7a4..dba7c7c7e8f01cf7abcc1c7a7953c935bedcdc61 100644
--- a/chrome/common/extensions/docs/server2/schema_util.py
+++ b/chrome/common/extensions/docs/server2/schema_util.py
@@ -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)]
- schemas = json_parse.Parse(file_data)
+ 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).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698