From: Mihai Bazon Date: Mon, 2 Sep 2013 06:55:34 +0000 (+0300) Subject: Better reporting of parse errors X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=a89d23331802cabb690ac817a5a7c93144a4f9c9;p=UglifyJS.git Better reporting of parse errors --- diff --git a/bin/uglifyjs b/bin/uglifyjs index 7a4f6224..90b71a20 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -257,11 +257,21 @@ async.eachLimit(files, 1, function (file, cb) { }); } else { - TOPLEVEL = UglifyJS.parse(code, { - filename : file, - toplevel : TOPLEVEL, - expression : ARGS.expr, - }); + 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();