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

Unified Diff: Source/devtools/scripts/modular_build.py

Issue 718393006: DevTools: Log non-well-formed JSON file name when compiling frontend (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Factor out JSON loading and parsing Created 6 years, 1 month 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: Source/devtools/scripts/modular_build.py
diff --git a/Source/devtools/scripts/modular_build.py b/Source/devtools/scripts/modular_build.py
index db27030b996eb7a0f022241f22a3e6a084f75dd6..48718335a8620980c700fb1af4d85052e476222f 100755
--- a/Source/devtools/scripts/modular_build.py
+++ b/Source/devtools/scripts/modular_build.py
@@ -33,6 +33,14 @@ def bail_error(message):
raise Exception(message)
+def load_and_parse_json(filename):
+ try:
+ return json.loads(read_file(filename))
+ except:
+ print 'ERROR: Failed to parse %s' % filename
+ raise
+
+
def concatenate_scripts(file_names, module_dir, output_dir, output):
for file_name in file_names:
output.write('/* %s */\n' % file_name)
@@ -143,8 +151,8 @@ class DescriptorLoader:
for application_descriptor_name in application_descriptor_names:
module_descriptors = {}
application_descriptor_filename = path.join(self.application_dir, application_descriptor_name)
- application_descriptor_json = read_file(application_descriptor_filename)
- application_descriptor = {desc['name']: desc for desc in json.loads(application_descriptor_json)}
+ application_descriptor = {desc['name']: desc for desc in load_and_parse_json(application_descriptor_filename)}
+
for name in application_descriptor:
merged_application_descriptor[name] = application_descriptor[name]
@@ -167,6 +175,6 @@ class DescriptorLoader:
json_filename = path.join(self.application_dir, module_name, 'module.json')
if not path.exists(json_filename):
bail_error('Module descriptor %s referenced in %s is missing' % (json_filename, application_descriptor_filename))
- module_json = json.loads(read_file(json_filename))
+ module_json = load_and_parse_json(json_filename)
module_json['name'] = module_name
return module_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