3

I'm having trouble with nodejs generators, when I launch my code I got the following error :

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.

The code is the following , I use AdoniJs. User.all and user.typeModule are both database relations.

// 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()
      })
    })
  }
}

Thank you

Romain Kraft
  • 83
  • 1
  • 5

0 Answers0