You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: yield a function, promise, generator, array, or object?
And it is hard to trace the problem, mostly it is happen when I yield a undefined value, so why not just allow to yield undefind.
Below code explain a case that how it happen.
function load(x){
return function(callback) {
db.load(x, callback);
}
}
function loadFields(obj) {
if(!obj) return;
obj.x = load(obj.x);
obj.y = load(obj.y);
obj.z = load(obj.z);
return obj;
}
co(function*() {
var obj = yield getFromDb(id) // should return {x:1, y: 2, z:3};
obj = yield loadFields(obj); // If obj is undefind, this line will occurs a Error, and hard to trace to this line.
})()
The text was updated successfully, but these errors were encountered:
it would be much harder to track down if we did allow yield undefined, I'd probably only use object/array support in the co call itself, otherwise it's a little unclear what the intent is since it's such a sugary feature
I offen get this error
And it is hard to trace the problem, mostly it is happen when I yield a undefined value, so why not just allow to yield undefind.
Below code explain a case that how it happen.
The text was updated successfully, but these errors were encountered: