Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some/any reject if race is unwinnable due to too few inputs #332

Merged
merged 1 commit into from Jun 17, 2014

Conversation

briancavalier
Copy link
Member

Docs and unit tests updated as well.

See #330

@scothis
Copy link
Member

scothis commented Jun 16, 2014

Should it throw instead of reject? The error is synchronous. Fail fast, fail loud.

@briancavalier
Copy link
Member Author

@scothis, Yeah, it's a good question. @unscriptable and I talked about it briefly. One issue is that we wouldn't be able to throw synchronously in all cases since any and some happily accept a promise for an array. So, if you provided a promise for a zero-length array, you'd get a rejection, but if you provided a concrete zero-length array, you'd get a sync throw. Given that, I think the best option is just to make them fail in the same way in case someone actually does want to handle it.

Also, since unhandled rejection reporting is on by default now, you'll likely see the error almost instantaneously in the console unless you catch it. It's pretty fail-fast/loud now, even though it doesn't cause a true crash.

@scothis
Copy link
Member

scothis commented Jun 16, 2014

@briancavalier good point. Better to be consistent!

@unscriptable
Copy link
Member

I went through the same mental exercise, @scothis. :) 👍 for consistency.

@briancavalier
Copy link
Member Author

Rebased after a couple of small changes on master.

briancavalier added a commit that referenced this pull request Jun 17, 2014
Make some/any reject if race is unwinnable due to too few inputs
@briancavalier briancavalier merged commit e45f3c7 into master Jun 17, 2014
@briancavalier briancavalier deleted the fix-any-some-empty-array branch June 19, 2014 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants