medikoo/memoizee

Unhandled rejection; breaking change

gajus opened this issue · 4 comments

gajus commented

Whatever change has been made in the last 7 days is causing my code to throw unhandled rejection. Assuming this is not a bug/ regression, this should have been a major version release.

gajus commented

It appears that setting promise: 'then' returns the original behaviour.

@gajus can you provide more details? memoizee on it's own doesn't throw on unhandled rejections.

There was a change to promise handling, but it was more in a category of bug fix, than new feature.
It's in older version where memoizee by default, assuming promise implementation provided done, thrown on rejections (and not necessary unhandled), it's not the case anymore.

@gajus I looked closer and indeed there's a bug in promise handling, fix will be coming shortly.

Fixed with 5b79698 and published as v0.4.10

Problem is that then:finally mode (which was turned on as default in case of promise implementation implenenting finally) stood on flawed assumption, that following won't report unhandled rejection:

var promise = Promise.reject(new Error("Rejection"));

promise.then(function () {});
promise.catch(function () {});

Thing is that promise created by promise.then also comes as rejection and that one will be reported as unhandled. I removed then:finally mode totally, as it can't work right.

Sorry for issues it caused :)