Permalink
Browse files

Fix scope in `publish` error handler

Fix crash:

    npm ERR! TypeError: Cannot call method 'error' of undefined
    npm ERR!     at handle (/Users/maciej/dev/js/npm/node_modules/npm-registry-client/lib/publish.js:79:18)
    npm ERR!     at RegClient.<anonymous> (/Users/maciej/dev/js/npm/node_modules/npm-registry-client/lib/publish.js:88:24)
    npm ERR!     at cb (/Users/maciej/dev/js/npm/node_modules/npm-registry-client/lib/request.js:27:9)
    npm ERR!     at RegClient.<anonymous> (/Users/maciej/dev/js/npm/node_modules/npm-registry-client/lib/request.js:148:10)
    npm ERR!     at cb (/Users/maciej/dev/js/npm/node_modules/npm-registry-client/lib/request.js:158:9)
    npm ERR!     at RegClient.<anonymous> (/Users/maciej/dev/js/npm/node_modules/npm-registry-client/lib/request.js:223:20)
    npm ERR!     at self.callback (/Users/maciej/dev/js/npm/node_modules/request/main.js:120:22)
    npm ERR!     at Request.EventEmitter.emit (events.js:124:20)
    npm ERR!     at ClientRequest.self.clientErrorHandler (/Users/maciej/dev/js/npm/node_modules/request/main.js:222:10)
    npm ERR!     at ClientRequest.EventEmitter.emit (events.js:94:17)
  • Loading branch information...
mmalecki authored and isaacs committed Mar 4, 2013
1 parent 35d9bb0 commit 465284a7a099e08b59a94846a3d2119d91d40e16
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/publish.js
View
@@ -85,10 +85,10 @@ function publish (data, tarball, cb) {
var rev = fullData._rev;
attach.call(this, data.name, tarball, tbName, rev, function (er) {
- if (er) return handle(er)
+ if (er) return handle.call(this, er)
this.log.verbose("publish", "attached", [data.name, tarball, tbName])
this.request("PUT", dataURI, data, function (er) {
- if (er) return handle(er)
+ if (er) return handle.call(this, er)
return cb(er)
}.bind(this))
}.bind(this))

0 comments on commit 465284a

Please sign in to comment.