-
Notifications
You must be signed in to change notification settings - Fork 147
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
Cannot read property '__ConsumeGenerator__' of null #518
Comments
Replacing |
I think this is an easy fix. The call to I'm away from my computer for the new week or so though, so I won't be able to get around to this until then. |
@vqvu You mean this check? |
Yeah. |
I'm having trouble reproducing this, I translated it into ES5 here to create a failing test case but it passes for me. Is there something wrong with my code here? var fn = function() {
return _(Promise.resolve([]))
.map(function (x) {
return _(Promise.resolve([]));
})
.parallel(1)
.consume(function (err, data, push, next) {
push(null, _.nil);
});
};
_([_([['data']]),
fn().collect()])
.parallel(2)
.collect()
.each(function(xs) {
console.log(xs);
}); |
Here's a more explicit test case. var _ = require("highland");
// Code path is this:
// - push(...) causes s.destroy() to be queued.
// - next2 is queued.
// - next1 is executed, which queues _runGenerator
// - destroy() runs and clears the _generator.
// - next2 runs and sets the _generator_requested flag.
// - _runGenerator runs and is allowed to be executed because _generator_requested
// was set.
var s = _(function (push, next) {
setTimeout(function () {
push(new Error("error"));
_.setImmediate(next); // next2
next(); // next1
}, 0);
});
s.pull(function (err, x) {
// This pull is required to un-pause the stream.
s.pull(function () {
// Ignore.
});
_.setImmediate(function () {
s.destroy();
});
}); I thought about this more and I think the correct fix is to check for |
Ah yes, this causes failures for me now too. I'll raise a PR in the morning. |
@vqvu I've verified, and the fix does resolve the problem. |
#521 was merged, so I will close this. |
Environment
Example (CoffeeScript)
Error
Does only happen when
Promise
are in use.Substituting
Promise.resolve([])
to[[]]
works without error.The text was updated successfully, but these errors were encountered: