Is it a fetch network error? (for the purpose of retrying on failure).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://twitter.com/xinganwang/status/1189266788237885443 | |
github/fetch: TypeError: Network request failed | |
Chrome: TypeError: Failed to fetch | |
Firefox: TypeError: NetworkError when attempting to fetch resource. | |
Safari: TypeError: The Internet connection appears to be offline. | |
*/ | |
const isNetworkError = e => | |
/The Internet connection appears to be offline|Failed to fetch|Network request failed|NetworkError when attempting to fetch resource|The network connection was lost/.test( | |
e.message | |
) || | |
e.statusCode === 502 || | |
e.statusCode === 504; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment