Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

es6-promise is not a safe polyfill to recommend in your readme #111

Closed
nilliams opened this issue Oct 19, 2016 · 6 comments
Closed

es6-promise is not a safe polyfill to recommend in your readme #111

nilliams opened this issue Oct 19, 2016 · 6 comments

Comments

@nilliams
Copy link

nilliams commented Oct 19, 2016

es6-promise's strict spec handling of uncaught exceptions (by not doing so at all) is a footgun. I don't feel like it should be the default recommendation of polyfill, and personally is the reason I've kept my team away from fetch() for months. Here are examples why:

Bluebird, however does the right thing:

I'm not saying Bluebird should be what you suggest instead, as I haven't dug into relative sizes/support/practicalities of that. I just feel that recommending people use es6-promise is going to cause a lot of people pain.

@ysmood
Copy link

ysmood commented Oct 20, 2016

I came from stefanpenner/es6-promise#70 (comment)

Maybe you could give Promise lib yaku a try.

Features

  • The minified file is only 4.1KB (1.8KB gzipped)
  • Supports "uncaught rejection" and "long stack trace", [Comparison][docs/debugHelperComparison.md]
  • Designed to work on IE5+ and other major browsers
  • 100% statement and branch test coverage
  • Much better performance than the native Promise
  • Well commented source code with every Promises/A+ spec

@nilliams
Copy link
Author

nilliams commented Oct 21, 2016

Yaku looks excellent, and ticks all my personal boxes, thank you! I love the fact it's small and has passing test coverage too, seems like a good fit for alternative polyfill recommendation here!

I've been trying to pin this down even more, because when I actually hit it I felt it was way worse than I've actually demonstrated so far. And I remembered that even when you .catch() and re-throw, es6-promise does NOT surface the error/exception.

To me this is the most concrete example, where the developer is absolutely doing all the right things, and the error is STILL swallowed:

http://requirebin.com/?gist=9c59be0170fa7691a534705daf6b765d

And (now using Yaku as alternative), here's how you do it right:

http://requirebin.com/?gist=8e1d11f8754e58afd271a994760bb0c4

@ysmood
Copy link

ysmood commented Oct 21, 2016

If you have any problem with Yaku, please feel free to issue me. The project is quite active to user feedbacks now.

@ysmood
Copy link

ysmood commented Oct 25, 2016

Sad story.
On Sat, 22 Oct 2016 at 4:15 AM Nick Williams [email protected]
wrote:

To make matters even worse the author has now closed that issue thread, so
it's not even visible to people now that it's an issue:
stefanpenner/es6-promise#70
stefanpenner/es6-promise#70


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#111 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABWZQLp0R61aNwevzCqx_ZT5o5rHv0ACks5q2R1wgaJpZM4Kbj6l
.

@developit
Copy link

I would recommend looking at promise-polyfill. I tested a bunch of polyfills and it's the smallest and I don't think it has that footgun.

@matthew-andrews
Copy link
Owner

This repo no longer recommends any polyfill.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants