Closed wycats closed 12 years ago
Hmm, so first, I agree that by the Promises/A spec libraries should be allowed to throw upon disallowed state transitions. I'd probably implement it more simply, with just a try
/catch
around the possibly-throwing operation. Will integrate.
However, the intent of the Promises/A proposal (in particular requirement 3.2) disallows throwing in this case. In particular, you should be able to give a resolver (i.e. a fulfill and/or reject function) to "mutually suspicious consumers," such that they "race" to resolve the promise, with neither knowing the state of the promise or in particular observing the actions of the other.
I'll add tests for this additional intent under a new, complimentary test suite.
Thanks for this!
This pull request adds support for promises libraries that choose to throw when they are resolved or rejected after being resolved or rejected. At present, the test suite requires that libraries silently swallow the attempt.