@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...
    • Runs a function with automatic retry: configurable attempts, backoff, jitter, per-attempt timeout, and cooperative cancellation.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>

      RetryExhaustedError when every attempt failed, or retryIf declined the latest failure. An abort reason, RangeError for an invalid attempt count, or an exception thrown by retryIf/onRetry propagates directly instead of being added to attempt history.

      const data = await retry(() => fetchData(url));

      try {
      await retry(({ signal }) => fetch(url, { signal }), {
      maxAttempts: 5,
      timeoutMs: 2000,
      signal: context.signal,
      });
      } catch (error) {
      if (error instanceof RetryExhaustedError) {
      logger.error(`gave up after ${error.attempts}`, error, { history: error.history });
      }
      }