Fetch: IE11 support and DOMException

Created on 16 Jul 2018  路  5Comments  路  Source: github/fetch

I totally understand that polyfilling DOMException is not a surface of this polyfill, but I think that Aborting requests README section should have a note that DOMException also should be polyfilled in browsers that don't support it (or its constructor).

The new DOMException constructor is not implemented in IE11 and would throw.

PS: not sure I can find a polyfill that adds the DOMException constructor support over there. If so - it perhaps also could be noted.

Most helpful comment

We export DOMException. That way you can use it in error-handling code without having to rely on the presence of native one. We're not certain enough in our polyfill of DOMException that we would automatically add it to the global namespace.

All 5 comments

Oops, I see that it's polyfilled below https://github.com/github/fetch/blob/master/fetch.js#L427

Sorry

@zerkms, it's polyfilled but it's not in global namespace. So, I think it makes sense to reopen this issue. Otherwise you need to add additional custom code that would put DOMException into global namespace.

@ArtemZag yep, makes sense.

We export DOMException. That way you can use it in error-handling code without having to rely on the presence of native one. We're not certain enough in our polyfill of DOMException that we would automatically add it to the global namespace.

I'm closing this because it doesn't look to me like there's anything actionable for us to do.

  1. We reference DOMException internally, but that code will also work in IE 11 because we use our own ponyfill of DOMException;
  2. The "Aborting requests" chapter in our README shows code example that avoids referencing DOMException and instead does if (ex.name === 'AbortError'), and thus will work in any browser;
  3. If for some reason you have to handle DOMException in your code, you can get our ponyfill from our module exports.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

seekcx picture seekcx  路  4Comments

shirotech picture shirotech  路  3Comments

proofrock picture proofrock  路  3Comments

hannesvdvreken picture hannesvdvreken  路  4Comments

huanghaiyang picture huanghaiyang  路  3Comments