Skip to content

Commit

Permalink
print error stack in CLI (#1890)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed May 9, 2017
1 parent bc3fa78 commit c14e280
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bin/uglifyjs
Expand Up @@ -193,7 +193,7 @@ function run() {
}
}
} catch (ex) {
fatal("ERROR: " + ex.message);
fatal(ex.stack);
}
var result = UglifyJS.minify(files, options);
if (result.error) {
Expand All @@ -220,7 +220,7 @@ function run() {
console.error("Supported options:");
console.error(ex.defs);
}
fatal("ERROR: " + ex.message);
fatal(ex.stack);
} else if (program.output == "ast") {
console.log(JSON.stringify(result.ast, function(key, value) {
if (skip_key(key)) return;
Expand Down Expand Up @@ -263,7 +263,7 @@ function run() {
}

function fatal(message) {
console.error(message);
console.error(message.replace(/^\S*?Error:/, "ERROR:"));
process.exit(1);
}

Expand Down Expand Up @@ -303,7 +303,7 @@ function read_file(path, default_value) {
return fs.readFileSync(path, "utf8");
} catch (ex) {
if (ex.code == "ENOENT" && default_value != null) return default_value;
fatal("ERROR: " + ex.message);
fatal(ex.stack);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/mocha/cli.js
Expand Up @@ -185,7 +185,7 @@ describe("bin/uglifyjs", function () {

exec(command, function (err, stdout, stderr) {
assert.ok(err);
assert.strictEqual(stderr, "ERROR: inline source map only works with singular input\n");
assert.strictEqual(stderr.split(/\n/)[0], "ERROR: inline source map only works with singular input");
done();
});
});
Expand Down

0 comments on commit c14e280

Please sign in to comment.