Skip to content
This repository has been archived by the owner on Jun 2, 2021. It is now read-only.

generator function 的 middleware 不再支持了? #5

Closed
fengmk2 opened this issue Feb 6, 2017 · 2 comments
Closed

generator function 的 middleware 不再支持了? #5

fengmk2 opened this issue Feb 6, 2017 · 2 comments

Comments

@fengmk2
Copy link
Contributor

fengmk2 commented Feb 6, 2017

之前还能跑的代码

app.use(function* (next) {
    yield next;
});

今天跑 benchmark 发现提示失败了

Internal Server Error  Error: Not thunkable function: function* (next) {
      yield next;
    }
      at Server.requestListener (/Users/mk2/git/github.com/eggjs/egg/node_modules/.2.5.1@toa/lib/application.js:232:22)
@zensh
Copy link
Member

zensh commented Feb 6, 2017

应该一直没有这个语法才对~是这样的:

app.use(function* () {
    yield something;
});

toa 一直没有级联 next。应该是 thunks 做了严格检查,不在允许 next 参数,之前允许,它也是个 undefined

@fengmk2
Copy link
Contributor Author

fengmk2 commented Feb 6, 2017

好吧,之前是能跑的,我改成一个空的 promise 好了。

@fengmk2 fengmk2 closed this as completed Feb 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants