Skip to content

Commit

Permalink
fix #29
Browse files Browse the repository at this point in the history
  • Loading branch information
yortus committed Jan 5, 2016
1 parent f20e964 commit 250cba2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/await/makeAwaitFunc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/await/makeAwaitFunc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ function getExtraInfo(traverse: (o, visitor: Function) => void, topN?: number) {
if (expr && _.isFunction(expr.then)) {

// A promise: resume the coroutine with the resolved value, or throw the rejection value into it.
expr.then(val => { fiber.run(val); fiber = null; }, err => { fiber.throwInto(err); fiber = null; });
// NB: ensure the handlers return null to avoid bluebird 3.x warning 'a promise was created in a
// handler but none were returned from it'. This occurs if the next resumption of the suspendable
// function (i.e. in the client's code) creates a bluebird 3.x promise and then awaits it.
expr.then(val => (fiber.run(val), fiber = null), err => (fiber.throwInto(err), fiber = null));
}
else if (_.isFunction(expr)) {

Expand Down

0 comments on commit 250cba2

Please sign in to comment.