我遇到了nodejs生成器的问题,当我启动代码时出现以下错误:
node:3632) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: The iterator does not provide a 'throw' method.
(node:3632) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
代码如下,我使用AdoniJs。 User.all和user.typeModule都是数据库关系。
// This is the function that is called at the defined schedule
* handle () {
const usersWrapper = yield User.all()
yield * usersWrapper.map(function * (user) {
const typeModulesWrapper = yield user.typeModule()
typeModulesWrapper.map(function (module) {
const Controller = use(module.controller_path)
Controller.event()
})
})
}
}
谢谢