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
18 lines (17 loc) • 427 B
JavaScript
export class AbortError extends Error {
constructor(error, currentTry) {
super("function call aborted due to an error");
this.error = error;
this.currentTry = currentTry;
this.abortError = true;
}
getError() {
return this.error;
}
getCurrentTry() {
return this.currentTry;
}
}
export function isAbortError(error) {
return error.abortError === true;
}