tvrcgo / weixin-pay

微信支付 Nodejs SDK
MIT License
916 stars 241 forks source link

有时会出现TypeError: Cannot read property 'nonce_str' of undefined #10

Closed zlm919 closed 7 years ago

zlm919 commented 8 years ago

使用wxpay.getBrandWCPayRequestParams时有时会出现 TypeError: Cannot read property 'nonce_str' of undefined at C:\node_modules\weixin-pay\lib\wxpay.js:87:18 at Parser. (C:\node_modules\weixin-pay\node_modules\xml2js\lib\xml2js.js:488:18) at emitOne (events.js:77:13) at Parser.emit (events.js:169:7) at Parser.exports.Parser.Parser.parseString (C:\node_modules\weixin-pay\node_modules\xml2js\lib\xml2js.js:507:16) at Parser.parseString (C:\node_modules\weixin-pay\node_modules\xml2js\lib\xml2js.js:7:59) at Object.exports.parseXML (C:\node_modules\weixin-pay\lib\util.js:11:9) at Request._callback (C:\node_modules\weixin-pay\lib\wxpay.js:75:8) at self.callback (C:\node_modules\weixin-pay\node_modules\request\request.js:200:22) at emitOne (events.js:77:13)

lymanlai commented 7 years ago

@zlm919 参数不对,导致微信返回错误,然后他没有正确的处理导致的。

tvrcgo commented 7 years ago

@zlm919 @lymanlai working on v2.0,有可能的话帮助测试

genru commented 6 years ago

why close is issue? apperently, this lib does not handle failure properly, a proper error should be return, not a exception.

I believe it can be more robust.