Browse Source

no retry if client error

master
nkzawa 9 years ago
parent
commit
51286add0f
  1. 12
      lib/index.js

12
lib/index.js

@ -87,10 +87,10 @@ export default class Now extends EventEmitter {
}); });
if (this._debug) console.timeEnd('> [debug] /create'); if (this._debug) console.timeEnd('> [debug] /create');
// no retry on 403 // no retry on 4xx
if (403 === res.status) { if (400 <= res.status && 500 > res.status) {
if (this._debug) { if (this._debug) {
console.log('> [debug] bailing on creating due to 403'); console.log('> [debug] bailing on creating due to %s', res.status);
} }
return bail(responseError(res)); return bail(responseError(res));
} }
@ -140,9 +140,9 @@ export default class Now extends EventEmitter {
}); });
if (this._debug) console.timeEnd(`> [debug] /sync ${name}`); if (this._debug) console.timeEnd(`> [debug] /sync ${name}`);
// no retry on 403 // no retry on 4xx
if (403 === res.status) { if (400 <= res.status || 500 > res.status) {
if (this._debug) console.log('> [debug] bailing on creating due to 403'); if (this._debug) console.log('> [debug] bailing on creating due to %s', res.status);
return bail(responseError(res)); return bail(responseError(res));
} }

Loading…
Cancel
Save