Wit.ai 承诺问题
Wit.ai Promises Issue
使用 Wit,它调用了一个自定义操作,但我的函数调用堆栈似乎没有返回承诺,我不明白为什么
https://gist.github.com/mark-stephenson-/e0200233663b2cf1ce1d0a5a33559372
我在控制台中得到的错误是:
Oops! Got an error from Wit: TypeError: Cannot read property 'then' of
undefined at /usr/local/workspace/nodeapps/levelup/index.js:130:9 at
Object.activate_schedule
(/usr/local/workspace/nodeapps/levelup/index.js:128:12) at
/usr/local/workspace/nodeapps/levelup/node_modules/node-wit/lib/wit.js:121:36
at process._tickCallback (internal/process/next_tick.js:103:7)
我试过将 LevelUp.set_activation_state 函数包装在一个 promise 中并返回它,但随后该函数根本没有调用。
你需要从里面 return this.get_user()
LevelUp.prototype.set_activation_state
使用 Wit,它调用了一个自定义操作,但我的函数调用堆栈似乎没有返回承诺,我不明白为什么
https://gist.github.com/mark-stephenson-/e0200233663b2cf1ce1d0a5a33559372
我在控制台中得到的错误是:
Oops! Got an error from Wit: TypeError: Cannot read property 'then' of undefined at /usr/local/workspace/nodeapps/levelup/index.js:130:9 at Object.activate_schedule (/usr/local/workspace/nodeapps/levelup/index.js:128:12) at /usr/local/workspace/nodeapps/levelup/node_modules/node-wit/lib/wit.js:121:36 at process._tickCallback (internal/process/next_tick.js:103:7)
我试过将 LevelUp.set_activation_state 函数包装在一个 promise 中并返回它,但随后该函数根本没有调用。
你需要从里面 return this.get_user()
LevelUp.prototype.set_activation_state