Note that the original use case relies on the "cache" throwing an exception if the entry is not found. If the cache instead returns `Promise.race()` (that is, a never-fulfilled promise) for entry-not-found, then `Promise.race(tryCache(), tryNetwork())` just works.
I'm not fond of the rejection handling of the `bluebird` utility functions `Promise.some()` and `Promise.any()`. I considered them for `prfun` and decided that I didn't want to support this API. Note also that the matter of merging/reporting all the rejections is awkward; `bluebird` uses a new `AggregateError` class for this. And as was mentioned earlier, there's no good way to get the set of all rejections is the result eventually resolves. But I would support some variant on bluebird's `Promise.some()` that generalized `Promise.race` to a specific number of fulfilled promises. I think preserving the "reject if any reject" behavior of `Promise.race` is important, but an ES7 `Promise.some(n)` could return an array of length `n` with the first `n` promises to be fulfilled. --scott (who goes off to try implementing that in `prfun`) _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

