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);
if (errors.length) {
var msg = [];
_.each(errors, function (err) {
msg.push(err.message + " - " + JSON.stringify(err.node));
});
throw new Error(loc + ": " + msg.join(". "));
throw new Error(loc + ": " + msg.join(". ") + "\n" + code);
}
};