On Wednesday, May 1, 2013 at 9:24 PM, Chris Vincent wrote:
I'm having trouble understanding how to handle an exception such that it doesn't get re-raised when I call done(). See here:Am I missing something fundamental here?--
You received this message because you are subscribed to the Google Groups "Q Continuum (JavaScript)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to q-continuum...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
In short, yes. Promises never change their state. Instead, methods like `then` or `fail` return new promises, whose states are derived from the old ones. `rejectedPromise` will always be rejected, and the semantics of `.done()` is to throw when called on a rejected promise.
On the other hand, `var p = rejectedPromise.fail(function (err) { return true; })` will be a new promise, `p`, fulfilled with `true`. If you call `p.done()`, then the error will not be re-thrown.
Hah, beat me by seconds!