Contentful Personalization & Analytics
    Preparing search index...
    • Creates a FetchMethod that combines timeout and retry protection.

      Parameters

      Returns FetchMethod

      A FetchMethod that applies timeout and retry logic to requests.

      Error Rethrows the original error after logging, including abort errors.

      The resulting method first wraps the base fetch with a timeout (via createTimeoutFetchMethod), then applies retry behavior (via createRetryFetchMethod).

      If an error is thrown during configuration or request execution, it is logged.

      const fetchProtected = createProtectedFetchMethod({
      apiName: 'Optimization',
      requestTimeout: 4000,
      retries: 2,
      })

      const response = await fetchProtected('https://example.com/experiences', {
      method: 'GET',
      })