@sapphire/utilities
Version:
Common JavaScript utilities for the Sapphire Community
24 lines (21 loc) • 621 B
JavaScript
;
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
// src/lib/retrySync.ts
function retrySync(cb, retries) {
if (retries < 0) throw new RangeError("Expected retries to be a number >= 0");
if (retries === 0) return cb();
let lastError;
for (let i = 0; i < retries; ++i) {
try {
return cb();
} catch (error) {
lastError = error;
}
}
throw lastError;
}
__name(retrySync, "retrySync");
exports.retrySync = retrySync;
//# sourceMappingURL=retrySync.cjs.map
//# sourceMappingURL=retrySync.cjs.map