-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
Hello,
I did q quick search and didn't find similar issue... It would be useful to have retry
and retryable
accept an optional errorFilter
sync function that will only allow the retry to continue if the function returns true
. for example something like:
var retryOpts = {
errorFilter: function (err) {
if(err.code === 11) return true; // only retry for error code 11
return false;
}
};
async.retry(retryOpts, apiMethod, function(err, result) {
// We know that we retried on error code 11, with other retry options being the defaults.
// if we got any other error we immediately bailed to here
if(err) console.log(err);
console.log(result);
});
This could be done in backwards compatible manner. Opinions? Would this be something accepted? I could probably try and do a PR sometime next week if so.
Thanks,
Bojan
hargasinski