How to use the axios-retry.isSafeRequestError function in axios-retry

To help you get started, we’ve selected a few axios-retry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vtex / node-vtex-api / src / utils / retry.ts View on Github external
export const isNetworkErrorOrRouterTimeout = (e: any) => {
  if (isNetworkOrIdempotentRequestError(e)) {
    printLabel(e, 'Retry from network error')
    return true
  }

  if (e && isSafeRequestError(e) && e.response && e.response.data && e.response.data.code === TIMEOUT_CODE) {
    printLabel(e, 'Retry from timeout')
    return true
  }

  return false
}

axios-retry

Axios plugin that intercepts failed requests and retries them whenever posible.

Apache-2.0
Latest version published 5 months ago

Package Health Score

80 / 100
Full package analysis

Similar packages