mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-08 23:25:51 +01:00
add err.status instead of checking for exact error message
it's done for consistency reasons
This commit is contained in:
parent
4470cb7d55
commit
a8cdfcd7cd
@ -358,7 +358,7 @@ Storage.prototype._sync_package_with_uplinks = function(name, pkginfo, options,
|
||||
}
|
||||
|
||||
up.get_package(name, _options, function(err, up_res, etag) {
|
||||
if (err && err.message === "bad status code: 304")
|
||||
if (err && err.status === 304)
|
||||
pkginfo._uplinks[up.upname].fetched = Date.now()
|
||||
|
||||
if (err || !up_res) return cb(null, [err || new Error('no data')])
|
||||
|
@ -248,7 +248,9 @@ Storage.prototype.get_package = function(name, options, callback) {
|
||||
}))
|
||||
}
|
||||
if (!(res.statusCode >= 200 && res.statusCode < 300)) {
|
||||
return callback(new Error('bad status code: ' + res.statusCode))
|
||||
var error = new Error('bad status code: ' + res.statusCode)
|
||||
error.status = res.statusCode
|
||||
return callback(error)
|
||||
}
|
||||
callback(null, body, res.headers.etag)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user