npm-registry-client
Advanced tools
Comparing version 4.0.3 to 4.0.4
21
index.js
@@ -13,5 +13,12 @@ // utilities for working with the js-registry site. | ||
catch (er) { | ||
npmlog = { error: noop, warn: noop, info: noop, | ||
verbose: noop, silly: noop, http: noop, | ||
pause: noop, resume: noop } | ||
npmlog = { | ||
error : noop, | ||
warn : noop, | ||
info : noop, | ||
verbose : noop, | ||
silly : noop, | ||
http : noop, | ||
pause : noop, | ||
resume : noop | ||
} | ||
} | ||
@@ -33,6 +40,6 @@ | ||
this.config.retry = this.config.retry || {} | ||
if (!this.config.retry.count) this.config.retry.count = 2 | ||
if (!this.config.retry.factor) this.config.retry.factor = 10 | ||
if (!this.config.retry.minTimeout) this.config.retry.minTimeout = 10000 | ||
if (!this.config.retry.maxTimeout) this.config.retry.maxTimeout = 60000 | ||
if (typeof this.config.retry.retries !== "number") this.config.retry.retries = 2 | ||
if (typeof this.config.retry.factor !== "number") this.config.retry.factor = 10 | ||
if (typeof this.config.retry.minTimeout !== "number") this.config.retry.minTimeout = 10000 | ||
if (typeof this.config.retry.maxTimeout !== "number") this.config.retry.maxTimeout = 60000 | ||
@@ -39,0 +46,0 @@ this.config.userAgent = this.config.userAgent || "node/" + process.version |
@@ -223,3 +223,3 @@ module.exports = regRequest | ||
if (parsed && parsed.error && response.statusCode >= 400) { | ||
if (parsed && parsed.error || response.statusCode >= 400) { | ||
var w = url.parse(where).pathname.substr(1) | ||
@@ -232,7 +232,16 @@ var name | ||
if (name && parsed.error === "not_found") { | ||
if (!parsed.error) { | ||
er = new Error( | ||
"Registry returned " + response.statusCode + | ||
" for " + method + | ||
" on " + where | ||
) | ||
} | ||
else if (name && parsed.error === "not_found") { | ||
er = new Error("404 Not Found: " + name) | ||
} else { | ||
} | ||
else { | ||
er = new Error( | ||
parsed.error + " " + (parsed.reason || "") + ": " + w) | ||
parsed.error + " " + (parsed.reason || "") + ": " + w | ||
) | ||
} | ||
@@ -242,3 +251,2 @@ if (name) er.pkgid = name | ||
er.code = "E" + er.statusCode | ||
} | ||
@@ -245,0 +253,0 @@ return cb(er, parsed, data, response) |
@@ -5,3 +5,3 @@ { | ||
"description": "Client for the npm registry", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "url": "git://github.com/isaacs/npm-registry-client" |
@@ -21,3 +21,3 @@ var test = require("tap").test | ||
var retry = client.config.retry | ||
t.equal(retry.count, 2, "default retry count is 2") | ||
t.equal(retry.retries, 2, "default retry count is 2") | ||
t.equal(retry.factor, 10, "default retry factor is 10") | ||
@@ -24,0 +24,0 @@ t.equal(retry.minTimeout, 10000, "retry minimum timeout is 10000 (10 seconds)") |
@@ -7,3 +7,3 @@ var tap = require("tap") | ||
retry : { | ||
count : 6, | ||
retries : 6, | ||
minTimeout : 10, | ||
@@ -10,0 +10,0 @@ maxTimeout : 100 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
282182
58
3430
9