diff options
author | Mihai Bazon <mihai@bazon.net> | 2013-09-02 09:55:34 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-09-02 09:55:34 +0300 |
commit | a89d23331802cabb690ac817a5a7c93144a4f9c9 (patch) | |
tree | 7fe00e772eeebbdfb677517cfa13b5c6a77b37f5 | |
parent | c28e1a023764993a3c9fd65ece2070ccc661237e (diff) | |
download | tracifyjs-a89d23331802cabb690ac817a5a7c93144a4f9c9.tar.gz tracifyjs-a89d23331802cabb690ac817a5a7c93144a4f9c9.zip |
Better reporting of parse errors
-rwxr-xr-x | bin/uglifyjs | 20 |
1 files changed, 15 insertions, 5 deletions
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(); |