Closed maciasello closed 10 years ago
Interesting, I would expect it not suppress... I believe RSVP.js would also suffer from this.
@maciasello yep, sounds like a bug. Looking into it now.
@maciasello I just pushed a fix to this branch. Could you give a try to see if it works for you? Thanks!
@briancavalier I tried a few simple commands in the console and played for a while with my components that use .finally()
. For this set it works correctly for the reported issue, but I started observing that when.reject(5).finally(function() {throw new Error();});
adds two unhandled rejections (originally one): the original promise and the one thrown from finally handler. This one for me is far from obvious how it should behave.
@maciasello Thanks for trying it, and good catch. That case should also only report 1 unhandled rejection, too. I'll add a unit test for that and refactor a bit more.
@maciasello Ok, b3eb15a fixes the extra unhandled rejection (which turned out to be introduced by my last change). I think we might have a winner, but def would appreciate your taking a look. Thanks!
... and c20481b improves the tests a bit by verifying the actual rejection reasons, in addition to the count.
@briancavalier I've tested the latest version from the branch and it works like a charm! Thanks for the fast reaction. What is a predicted schedule of a patch release?
@maciasello Great, thanks for verifying. I'm planning to release it today, although it may be later in the evening EST. I'll close this issue, and will merge the changes as a part of #358
@maciasello Just released 3.4.5 that includes this fix :) Thanks again for reporting the issue.
when.reject(5).finally(function() {});
does not produce theunhandled rejections
logwhen.reject(5).finally(function() {throw new Error();});
does produce itAs
promise1.finally(function() {})
still rejects whenpromise1
is rejected the log should be there if nothing attaches and handles the real error (not the cleanup as for finally).Ideas, comments, WAD?