Skip to content

Commit 28cdf48

Browse files
author
qucchia
committed
common.js: Give useful information when an error occurs
Prints the file name and JSON when an error occurs while parsing it.
1 parent 3bc5387 commit 28cdf48

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

scripts/common.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ exports.readWrapperFile = function(filename) {
8686
var endOfJson = comment.indexOf("\n}")+2;
8787
var json = comment.substr(0,endOfJson);
8888
var description = comment.substr(endOfJson).trim();
89-
var j = new Builtin(JSON.parse(json));
90-
if (description.length) j.description = description;
91-
j.implementation = filename;
92-
builtins.push(j);
89+
try {
90+
var j = new Builtin(JSON.parse(json));
91+
if (description.length) j.description = description;
92+
j.implementation = filename;
93+
builtins.push(j);
94+
} catch(e) {
95+
console.log("Error in ", filename);
96+
console.log(json);
97+
console.log(e);
98+
}
9399
});
94100
var comments = contents.match( /\/\*TYPESCRIPT(?:(?!\*\/).|[\n\r])*\*\//g );
95101
if (comments) comments.forEach(function(comment) {

0 commit comments

Comments
 (0)