Proposal: Bind Promise Catch to Try/Catch scope

Todd Hubers todd.hubers at alivate.com.au
Wed Jun 22 00:55:24 UTC 2016


see http://blog.alivate.com.au/callback-api-for-es6/

Problem: Try blocks don’t work in a callback world.

Proposed solution:

   - Implement API: window.callback.getCatch() - which is a callback to the
   parent catch block scope.
      - Ie. While the try scope is entered, internally the catch handler is
      stored as a function (window.callback.activeCatch.push(thisCatch)). When
      the try scope is left, that value is popped.
   - Promise: defaults its catch callback to whatever getCatch() returns

I'm sure there are plenty more details that could be covered and "Callback
API" and "getCatch" are totally open to debate. But I hope you get the gist
of it efficiently with this email.

Regards,

Todd Hubers (BBIT Hons)
Software Engineer

Contact <http://alivate.com.au/todd/> | Availability
<https://www.google.com/calendar/embed?src=todd.hubers@alivate.com.au&ctz=Australia/Sydney>



Sent with MailTrack
<https://mailtrack.io/install?source=signature&lang=en&referral=todd.hubers@alivate.com.au&idSignature=22>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160622/2a4bc639/attachment.html>


More information about the es-discuss mailing list