“在Foreach node.js中,迭代器不提供'throw'方法

我遇到了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() }) }) } } 

谢谢