I am of the opinion that program errors should fail loudly by default, which the current proposal does not support.
To this end, in my own promise implementation I use a form of "fail soon", like so: Define a promise tree. As a base case we have a promise created with the Promise constructor. Leaves are added to the tree by using the "then" method. The "promise forest" is the collection of all such trees for a running program. An "invalid promise tree" is a tree which contains a rejected leaf node which is not also a root. During a "callback flush", the callback queue is repeatedly emptied until no more callbacks remain. At the end of the callback flush, the promise forest is checked for any invalid promise trees. If there exists an invalid promise tree, then an unhandled error is thrown (which will of course propagate to window.onerror). It's worked well for me so far, and has obviated the need for bolt-ons like "done" or "console.unlog", etc. YMMV. https://github.com/zenparsing/zen-bits/blob/master/src/Promise.js { Kevin }
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss