0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-17 23:45:29 -05:00
This commit is contained in:
Alex Kocharin 2014-04-14 00:44:17 +00:00
parent fabf3eff4c
commit a79fa68deb
3 changed files with 8 additions and 3 deletions

View file

@ -163,6 +163,7 @@ function lock_and_read(name, callback) {
var buffer = new Buffer(st.size)
fs.read(fd, buffer, 0, st.size, null, function(err, bytesRead, buffer) {
if (err) return callback(err)
if (bytesRead != st.size) return callback(new Error('st.size != bytesRead'), fd)
callback(null, fd, buffer)

View file

@ -90,7 +90,7 @@ Storage.prototype.remove_package = function(name, callback) {
unlinkNext(function() {
// try to unlink the directory, but ignore errors because it can fail
self.storage(name).rmdir('.', function(err) {
callback()
callback(err)
})
})
})

View file

@ -158,7 +158,11 @@ Storage.prototype.request = function(options, cb) {
}
function do_decode() {
if (err) return error = err.message
if (err) {
error = err.message
return
}
if (options.json && res.statusCode < 300) {
try {
body = JSON.parse(body.toString('utf8'))
@ -204,7 +208,7 @@ Storage.prototype.request = function(options, cb) {
self.status_check(true)
}
})
req.on('error', function(err) {
req.on('error', function(_err) {
if (!req._sinopia_aborted && !status_called) {
status_called = true
self.status_check(false)