[Pkg-javascript-commits] [uglifyjs] 45/491: print error stack in CLI (#1890)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:20 UTC 2018


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit c14e2805859a3d85788af5d694fca73a6782530e
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Tue May 9 16:36:44 2017 +0800

    print error stack in CLI (#1890)
---
 bin/uglifyjs      | 8 ++++----
 test/mocha/cli.js | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bin/uglifyjs b/bin/uglifyjs
index 8bb8e70..d75b0ee 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -193,7 +193,7 @@ function run() {
             }
         }
     } catch (ex) {
-        fatal("ERROR: " + ex.message);
+        fatal(ex.stack);
     }
     var result = UglifyJS.minify(files, options);
     if (result.error) {
@@ -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;
@@ -263,7 +263,7 @@ function run() {
 }
 
 function fatal(message) {
-    console.error(message);
+    console.error(message.replace(/^\S*?Error:/, "ERROR:"));
     process.exit(1);
 }
 
@@ -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);
     }
 }
 
diff --git a/test/mocha/cli.js b/test/mocha/cli.js
index 8c7964a..8cf53ab 100644
--- a/test/mocha/cli.js
+++ b/test/mocha/cli.js
@@ -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();
         });
     });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list