fetch
fetch copied to clipboard
Use DOMException to throw errors
I believe React Native's environment does not provide DOMException, so we need to use a polyfill ~~or develop our own~~. Check domexpection. If that's the case, for consistency's sake, the polyfill should be delivered via react-native-polyfill-globals.
Check GitHub's implementation for inspiration.
DOMException should be thrown when:
- fetch is aborted
See: https://developers.google.com/web/updates/2017/09/abortable-fetch
Related: https://github.com/node-fetch/node-fetch/issues/1519
Note: This is technically part of the AbortController spec. React Native currently uses https://github.com/mysticatea/abort-controller so the change will need to be made there I think.