puppet-xp
puppet-xp copied to clipboard
sidecar.getChatroomMemberNickInfo will throw error and break the the flow
This project is so cool. 👍 BTW, I found an issue when I run the example and calling sidecar.getChatroomMemberNickInfo(). Code here: https://github.com/wechaty/wechaty-puppet-xp/blob/dfe9229b3f19914ee821b267ab04034cad642391/src/puppet-xp.ts#L176
From my test, it will throw exception if the member id can not get nickname successfully. The error like that,
Error [TypeError]: cannot read property 'then' of null
at <anonymous> (frida/runtime/message-dispatcher.js:14)
at c (frida/runtime/message-dispatcher.js:23) {
fileName: 'frida/runtime/message-dispatcher.js',
lineNumber: 14
}
As result, because this exception hasn't been catch. the follow logic cannot be ran for example register the event.
This is my fix,
let [err, memberNickName] = await this.sidecar.getChatroomMemberNickInfo(memberId, roomId).then(r => [undefined, r]).catch(e => [e])
if (err) {
memberNickName = 'no name'
}
Thanks for your watching ;)
@shihuihzh Thanks for your feedback, this error will be fixed in the next version.