Skip to content

Commit

Permalink
log filename when file fails to parse using esprima
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Jorgensen committed Jun 26, 2016
1 parent 5dbd62c commit 91bb666
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/instrumenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,18 @@
if (!this.opts.noAutoWrap) {
code = LEADER_WRAP + code + TRAILER_WRAP;
}
program = ESP.parse(code, {
loc: true,
range: true,
tokens: this.opts.preserveComments,
comment: true,
sourceType: this.opts.esModules ? 'module' : 'script'
});
try {
program = ESP.parse(code, {
loc: true,
range: true,
tokens: this.opts.preserveComments,
comment: true,
sourceType: this.opts.esModules ? 'module' : 'script'
});
} catch (e) {
console.log('Failed to parse file: ' + filename);
throw e;
}
if (this.opts.preserveComments) {
program = ESPGEN.attachComments(program, program.comments, program.tokens);
}
Expand Down

0 comments on commit 91bb666

Please sign in to comment.