-
Notifications
You must be signed in to change notification settings - Fork 793
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
Co throws when no callback provided #133
Comments
Oh I see why you did an optional callback .... because you expect that everything within co is wrapped with try/catch ... hmmm |
I am not sure what to do to avoid other people trap on this like me. First of all better documentation of the done callback. And probably all examples should use try/catch within co? |
probably just better docs, no point doing try/catch within co since co itself acts like a big try/catch, just propagates by default but I think that's better than the error getting lost in limbo. maybe when promises are everywhere we just return a promise and do whatever they do (what does a promise do if it has no handler? just wait until there is one?) |
if i have a question related to promises, i always ping @domenic! |
Regarding to promises, we have them already in 0.11 harmony version where generators actually work. So we can actually use the global Promise object. |
there are apparently some bugs with it. we could always "look for a promise library" if one isn't available and except users to include their own |
which bugs? can you point me? |
I mean as far as then and catch works as expected, it should be ok. |
I've read somewhere in docs that "co must be used in real life only with a callback". That saved some of my time when I learned it, but wasn't obvious from the examples. Maybe it's worth to use a callback in examples too. |
I'm -1 on promises until it's the v8 impl and it's decent |
the question is what's wrong with the current Promise object in v8. |
I haven't used them, I've heard they're super slow but that's alright I guess as long as they're not broken, not a real bottleneck anyway |
My 5cents: I've heard current V8 promises are not up2date with the spec. People suggest to use bluebird. |
V8 promises are up to date. The version of V8 that ships with Node 0.11 has a minor bug where it handles invalid arguments incorrectly. The biggest problem is nodejs/node-v0.x-archive#7714 which is a Node bug. |
@domenic looks also like a minor issue to me, no? |
@kof not really; using promises + setTimeout + nextTick can be pretty common (e.g. test runners testing a promise API). Once all three of those ingredients are present in a program, things break pretty massively. |
Co throws an error when no
done
callback provided.First of all its a documentation issue. But I think throwing errors is not a solution at all. Instead done callback should be non optional parameter.
The text was updated successfully, but these errors were encountered: