retry-as-promised
Advanced tools
Comparing version 5.0.0 to 6.0.0
21
index.js
'use strict'; | ||
var util = require('util'); | ||
var format = util.format; | ||
function TimeoutError(message, err) { | ||
Error.call(this); | ||
Error.captureStackTrace(this, TimeoutError); | ||
this.name = 'TimeoutError'; | ||
this.message = message; | ||
this.previous = err; | ||
class TimeoutError extends Error { | ||
constructor(message, err) { | ||
super(message); | ||
this.name = "TimeoutError"; | ||
this.previous = err; | ||
} | ||
} | ||
util.inherits(TimeoutError, Error); | ||
function matches(match, err) { | ||
@@ -94,7 +89,7 @@ if (match === true) return true; | ||
options.$current++; | ||
options.report(format('Retrying %s (%s)', options.name, options.$current), options); | ||
options.report(`Retrying ${options.name} (${options.$current})`, options); | ||
if (retryDelay) { | ||
// Use backoff function to ease retry rate | ||
options.report(format('Delaying retry of %s by %s', options.name, retryDelay), options); | ||
options.report(`Delaying retry of ${options.name} by ${retryDelay}`, options); | ||
backoffTimeout = setTimeout(function() { | ||
@@ -101,0 +96,0 @@ retryAsPromised(callback, options) |
{ | ||
"name": "retry-as-promised", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Retry a failed promise", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6844
93