diff options
author | isaacs <i@izs.me> | 2010-05-03 08:14:08 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-05-03 08:14:08 +0400 |
commit | 90f8b8006f70a52c47837997a6dc9c31685643a3 (patch) | |
tree | 44b67d5fb8e5e4cfc819a660c4d067d7ed3a7dd5 /cli.js | |
parent | 7c1a2328043476ee3ee66f2396b7b1e99bf930b7 (diff) |
Cleaner error handling.
Diffstat (limited to 'cli.js')
-rwxr-xr-x | cli.js | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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") }) |