第四天的回复各种消息
来源:
imooccodeing
2017-03-11
scotter老师,我这边遇到这个问题
这两句代码报出来的错
yield handler.call(this, next);
wechat.reply.call(this);
ReferenceError: handler is not defined
at Object.<anonymous> (/Users/apple/Desktop/workspace/wechat/wechat/g.js:40:15)
at Generator.next (<anonymous>)
at onFulfilled (/Users/apple/Desktop/workspace/wechat/node_modules/co/index.js:65:19)
at tryCatcher (/Users/apple/Desktop/workspace/wechat/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/apple/Desktop/workspace/wechat/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/apple/Desktop/workspace/wechat/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/Users/apple/Desktop/workspace/wechat/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/Users/apple/Desktop/workspace/wechat/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/Users/apple/Desktop/workspace/wechat/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/Users/apple/Desktop/workspace/wechat/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:666:20)
at tryOnImmediate (timers.js:639:5)
at processImmediate [as _immediateCallback] (timers.js:611:5)
2回答
-
入口文件里面,需要在 use 中间件的时候,传入第二个参数,就是这个 reply.reply,这个就是这里的 handler 函数
132017-03-12 -
Scott
2017-03-12
我还没有把代码放到 github 上,改天我整理一下放上去,github 我这两年很少上了
https://github.com/huanglong
00
相似问题