fetch icon indicating copy to clipboard operation
fetch copied to clipboard

Use DOMException to throw errors

Open acostalima opened this issue 4 years ago • 1 comments

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

acostalima avatar Jan 18 '21 15:01 acostalima

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.

tom-sherman avatar May 31 '22 16:05 tom-sherman