diff options
author | Joao Carlos <mail@joao-carlos.com> | 2015-06-09 14:31:49 +0300 |
---|---|---|
committer | Joao Carlos <mail@joao-carlos.com> | 2015-06-09 14:31:49 +0300 |
commit | 9aef34a8168f5de3bc00330a740c22de70314a70 (patch) | |
tree | 80bbaccb05f6f8afd42cc63d50e64872abcd35af | |
parent | 0ac6918a411c85304dc716cd6de68b293a0d133a (diff) | |
download | tracifyjs-9aef34a8168f5de3bc00330a740c22de70314a70.tar.gz tracifyjs-9aef34a8168f5de3bc00330a740c22de70314a70.zip |
Show descriptive error when --mangle-regex is invalid
-rwxr-xr-x | bin/uglifyjs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index 71c82644..9a1323fd 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -376,7 +376,15 @@ async.eachLimit(files, 1, function (file, cb) { if (ARGS.mangle_props || ARGS.name_cache) (function(){ var reserved = RESERVED ? RESERVED.props : null; var cache = readNameCache("props"); - var regex = ARGS.mangle_regex ? new RegExp(ARGS.mangle_regex) : null; + var regex; + + try { + regex = ARGS.mangle_regex ? new RegExp(ARGS.mangle_regex) : null; + } catch (e) { + print_error("ERROR: Invalid --mangle-regex: " + e.message); + process.exit(1); + } + TOPLEVEL = UglifyJS.mangle_properties(TOPLEVEL, { reserved : reserved, cache : cache, |