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
The AsyncIterator defines an optional throw method that can be used to make the iterator throw an error. This is useful when you have nested async iteration loops and you don’t want to wait for the child loop to terminate before continuing the parent loop, but you still want to propagate errors to avoid Promise rejections. Example:
forawait(constaofiterator){if(a.subscribe){(async()=>{forawait(constbofa.subscribe()){console.log(b);}// propagate errors to the parent})().catch((err)=>iterator.throw(err));}}
Figure out the rejection semantics for throw and how it interacts with next and return. My plan is for throw to close the channel with the error and await return. If the channel is already closed, should throw reject?
The text was updated successfully, but these errors were encountered:
The
AsyncIterator
defines an optional throw method that can be used to make the iterator throw an error. This is useful when you have nested async iteration loops and you don’t want to wait for the child loop to terminate before continuing the parent loop, but you still want to propagate errors to avoid Promise rejections. Example:Figure out the rejection semantics for
throw
and how it interacts withnext
andreturn
. My plan is forthrow
to close the channel with the error and awaitreturn
. If the channel is already closed, shouldthrow
reject?The text was updated successfully, but these errors were encountered: