Browse Source

filter some nasty errors

Related to #119 and #156
http2
Vsevolod Strukchinsky 9 years ago
parent
commit
01d54e8e49
  1. 5
      index.js
  2. 3
      package.json

5
index.js

@ -17,6 +17,7 @@ const unzipResponse = require('unzip-response');
const createErrorClass = require('create-error-class');
const nodeStatusCodes = require('node-status-codes');
const isPlainObj = require('is-plain-obj');
const isRetryAllowed = require('is-retry-allowed');
function requestAsEventEmitter(opts) {
opts = opts || {};
@ -254,8 +255,8 @@ function normalizeArguments(url, opts) {
if (typeof opts.retries !== 'function') {
const retries = opts.retries;
opts.retries = function backoff(iter) {
if (iter > retries) {
opts.retries = function backoff(iter, err) {
if (iter > retries || !isRetryAllowed(err)) {
return 0;
}

3
package.json

@ -45,11 +45,12 @@
"fetch"
],
"dependencies": {
"duplexer3": "^0.1.4",
"create-error-class": "^3.0.0",
"duplexer3": "^0.1.4",
"get-stream": "^1.1.0",
"is-plain-obj": "^1.0.0",
"is-redirect": "^1.0.0",
"is-retry-allowed": "^1.0.0",
"is-stream": "^1.0.0",
"lowercase-keys": "^1.0.0",
"node-status-codes": "^2.0.0",

Loading…
Cancel
Save