Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cli.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-05-03 08:14:08 +0400
committerisaacs <i@izs.me>2010-05-03 08:14:08 +0400
commit90f8b8006f70a52c47837997a6dc9c31685643a3 (patch)
tree44b67d5fb8e5e4cfc819a660c4d067d7ed3a7dd5 /cli.js
parent7c1a2328043476ee3ee66f2396b7b1e99bf930b7 (diff)
Cleaner error handling.
Diffstat (limited to 'cli.js')
-rwxr-xr-xcli.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/cli.js b/cli.js
index f77200151..839063274 100755
--- a/cli.js
+++ b/cli.js
@@ -44,10 +44,12 @@ for (var k in conf) npm.config.set(k, conf[k])
if (!command) npm.commands.help([arglist.join(" ")])
else npm.commands[command](arglist, function (er, ok) {
if (er) {
- npm.commands.help([command], function () {
- log(er.stack, "failed")
- process.stdout.flush()
- throw er
- })
+ sys.error("")
+ log("Error: "+er.message, "!")
+ var s = er.stack.split("\n").slice(2)
+ s.forEach(function (s) { log(s, "!") })
+ sys.error("")
+ log("try running: 'npm help "+command+"'", "failure")
+ log("or report this to <npm-@googlegroups.com>", "failure")
} else log("ok")
})