Closed benjamingr closed 10 years ago
@benjamingr Yeah, it seems pretty reasonable to reject for any kind of N-winner race where it's known up front that there simply aren't enough inputs to ever fulfill it. That jives with the notion that at the point where it's known that the race can't be fulfilled, it rejects. I think we considered doing that for 3.0, but it fell off the radar.
Using a RangeError
as suggested in petkaantonov/bluebird#233 seems pretty reasonable--better than returning never()
like race()
has to do :(
@unscriptable and @scothis, this would be a breaking change for 3.x, but honestly, I think I'd rather just call it a bug and fix it in 3.3 than wait for 4.0 (when.some is already deprecated anyway). Any thoughts or objections?
I know we'll likely break a few users' code, but this does feel like a bug.
:+1:
Fixed by #332. Thanks again @benjamingr!
Currently, with the following code both
when.any([])
andwhen.any([resolvesToUndefinedFirst,...])
behave exactly the same way.I'm wondering why that is and what the rationale about it is. At first glance it seems to me that
when.any([])
(and similarlywhen.some
) should throw a range error.(Similarly, when calling
when.any
without an array argument).Thanks!
Related: https://github.com/petkaantonov/bluebird/issues/233
Online example: http://jsfiddle.net/3RAk8/