@cloudbitmaps/core 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -261,7 +261,12 @@ function applyJitter(policy, delayMs, rng) {
261
261
  }
262
262
  async function withRetry(op, policy, deps) {
263
263
  const retryable = deps.isRetryable ?? isTransient;
264
- const attempts = Math.max(1, policy.maxAttempts);
264
+ if (!Number.isFinite(policy.maxAttempts) || policy.maxAttempts < 1) {
265
+ throw new ValidationError(
266
+ `retry.maxAttempts must be a finite number >= 1 (got ${String(policy.maxAttempts)})`
267
+ );
268
+ }
269
+ const attempts = Math.floor(policy.maxAttempts);
265
270
  let lastErr;
266
271
  for (let attempt = 1; attempt <= attempts; attempt++) {
267
272
  try {