Better reporting of parse errors
This commit is contained in:
20
bin/uglifyjs
20
bin/uglifyjs
@@ -257,11 +257,21 @@ async.eachLimit(files, 1, function (file, cb) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TOPLEVEL = UglifyJS.parse(code, {
|
try {
|
||||||
filename : file,
|
TOPLEVEL = UglifyJS.parse(code, {
|
||||||
toplevel : TOPLEVEL,
|
filename : file,
|
||||||
expression : ARGS.expr,
|
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();
|
cb();
|
||||||
|
|||||||
Reference in New Issue
Block a user