dump code to esvalid errors

This commit is contained in:
Sebastian McKenzie
2015-02-08 01:26:46 +11:00
parent 067cf43f52
commit a15f218e9b
2 changed files with 3 additions and 3 deletions

View File

@@ -19,14 +19,14 @@ var readFile = exports.readFile = function (filename) {
} }
}; };
exports.esvalid = function (ast, loc) { exports.esvalid = function (ast, code, loc) {
var errors = esvalid.errors(ast); var errors = esvalid.errors(ast);
if (errors.length) { if (errors.length) {
var msg = []; var msg = [];
_.each(errors, function (err) { _.each(errors, function (err) {
msg.push(err.message + " - " + JSON.stringify(err.node)); msg.push(err.message + " - " + JSON.stringify(err.node));
}); });
throw new Error(loc + ": " + msg.join(". ")); throw new Error(loc + ": " + msg.join(". ") + "\n" + code);
} }
}; };

View File

@@ -54,7 +54,7 @@ var run = function (task, done) {
var checkAst = function (result, opts) { var checkAst = function (result, opts) {
if (noCheckAst) return; if (noCheckAst) return;
helper.esvalid(result.ast.program, opts.loc); helper.esvalid(result.ast.program, result.code, opts.loc);
}; };
if (execCode) { if (execCode) {