async-retry
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -32,4 +32,7 @@ 'use strict'; | ||
var onError = function onError(err) { | ||
if (err.bail) return bail(err); | ||
if (!op.retry(err)) { | ||
reject(op.mainError()); | ||
} else if (opts.onRetry) { | ||
opts.onRetry(err); | ||
} | ||
@@ -36,0 +39,0 @@ }; |
0.2.0 / 2016-05-30 | ||
================== | ||
* index: implement `onRetry` [@rauchg] | ||
0.1.1 / 2016-02-29 | ||
@@ -11,3 +16,1 @@ ================== | ||
* initial release | ||
{ | ||
"name": "async-retry", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./build/lib/index", |
@@ -12,3 +12,3 @@ # async-retry | ||
export default async function getSomething () { | ||
const res = await retry(async (bail) => { | ||
return await retry(async (bail) => { | ||
// if anything throws, we retry | ||
@@ -45,2 +45,3 @@ const res = await fetch('https://google.com'); | ||
* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `false`. | ||
* `onRetry`: an optional `Function` that is invoked after a new retry is performed. It's passed the `Error` that triggered it as a parameter. | ||
@@ -47,0 +48,0 @@ ## Credits |
4468
42
51