diff options
author | isaacs <i@izs.me> | 2013-06-19 21:54:23 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-06-19 21:54:23 +0400 |
commit | df9a0b370a3e989e60fe2ec28b3c7b17c2458ab7 (patch) | |
tree | ecc513ac5bf2d8a7d9d86c582c190b2943bb02b9 | |
parent | 0e0109f4cf76027265d81a1bee6e180ca268bf7e (diff) |
publish -f: Fail with the first error if unpublish failed
Otherwise, you get cryptic 'cannot publish over existing version'
stuff, when actually, you're not allowed to publish at all.
-rw-r--r-- | lib/publish.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/publish.js b/lib/publish.js index 62d7fb9bb..00ffdfae3 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -98,9 +98,12 @@ function publish_ (arg, data, isRetry, cachedir, cb) { log.warn("publish", "Forced publish over "+data._id) return npm.commands.unpublish([data._id], function (er) { // ignore errors. Use the force. Reach out with your feelings. - publish([arg], true, cb) + // but if it fails again, then report the first error. + publish([arg], er || true, cb) }) } + // report the unpublish error if this was a retry and unpublish failed + if (er && isRetry && isRetry !== true) return cb(isRetry) if (er) return cb(er) console.log("+ " + data._id) cb() |