UNPKG

ts-retry

Version:

A little retry tool to execute a function until the function is successful. Can also bind a timeout to a function. This lib is usable in typescript, in javascript, in node, in SPA tools (rest, Vue, Svelte...) and browser (available in ESM and common js fo

19 lines (18 loc) 556 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TooManyTries = void 0; exports.isTooManyTries = isTooManyTries; class TooManyTries extends Error { constructor(lastResult = undefined) { super("function did not complete within allowed number of attempts"); this.lastResult = lastResult; this.tooManyTries = true; } getLastResult() { return this.lastResult; } } exports.TooManyTries = TooManyTries; function isTooManyTries(error) { return error.tooManyTries === true; }