aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.44k stars 2.13k forks source link

release(required): network error has not been properly detected #13935

Closed HuiSF closed 3 weeks ago

HuiSF commented 1 month ago

Description of changes

  1. the isConnectionError of the defaultRetryDecider now detects network errors by looking up the name property to match either one of the [NetworkError, ERR_NETWORK]
    • NetworkError is thrown from the fetch transfer handler Core
    • ERR_NETWORK is thrown from the XHR transfer handler resides in Storage
  2. the tokenOrchestrator.handleErrors method now detects network errors by looking up the name property to match NetworkError, clearTokens() shall not be called when the error is a network error

Issue #, if available

Description of how you validated changes

  1. manual testing with a Next.js app and a react-native app
  2. unit tests

Checklist

Checklist for repo maintainers

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.