Skip to content
A promise retry library that allows deep inspection of error for retry conditions
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.travis.yml
README.md
index.js
package.json

README.md

Build Status

retry-promised

A package to support retrying promises that allows deep inspection of the error to decide whether to retry or not.

Usage

const retryPromised = require("retry-promised");

const options = {
    maxAttempts: 5, // defaults to 10
    retryTimeout: 1000, // Time in milliseconds (defaults to zero)
    timeoutMultiplier: 2, // allows exponential back-off (defaults to 1)
    retryCheck: err => err.hasOwnProperty("code") && err.code == "TooManyRequests" // defaults to () => true
};

retryPromised(someThingThatReturnsAPromise(), options)
    .then(val => {
        console.log("Success:", val);
    })
    .catch(err => {
        console.log("Failed:", err);
    });
You can’t perform that action at this time.