Better reporting of parse errors

This commit is contained in:
Mihai Bazon
2013-09-02 09:55:34 +03:00
parent c28e1a0237
commit a89d233318

View File

@@ -257,11 +257,21 @@ async.eachLimit(files, 1, function (file, cb) {
});
}
else {
try {
TOPLEVEL = UglifyJS.parse(code, {
filename : file,
toplevel : TOPLEVEL,
expression : ARGS.expr,
});
} catch(ex) {
if (ex instanceof UglifyJS.JS_Parse_Error) {
sys.error("Parse error at " + file + ":" + ex.line + "," + ex.col);
sys.error(ex.message);
sys.error(ex.stack);
process.exit(1);
}
throw ex;
}
};
});
cb();