You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I found that people are complaining about wechaty logout operation throw errors. I dig into the log and find that, some operations on the ContactSelf was triggered, and since the bot is logged out, error thrown out.
Here is the code in wechaty-puppet that trigger the error:
publicselfId(): string {log.verbose('Puppet','selfId()')if(!this.id){thrownewError('not logged in, no this.id yet.')}returnthis.id}
It's totally okay for it throw such error message out, but when using it in wechaty, like this:
publicasyncqrcode(): Promise<string>{
log.verbose('Contact','qrcode()')if(this.id!==this.puppet.selfId()){thrownewError('only can get qrcode for the login userself')}constqrcodeValue=awaitthis.puppet.contactSelfQrcode()returnqrcodeValue}
An error with message not logged in, no this.id yet. will be printed out in the console, and to whom are writing bot with wechaty, they will treat this error message as "system message" (which means thrown out by wechaty and should be handled by wechaty)
So I suggest to have a better error message here, to indicate that what operation failed and for what reason that the operation failed. I will submit a PR later to illustrate my proposal.
The text was updated successfully, but these errors were encountered:
Today I found that people are complaining about
wechaty
logout operation throw errors. I dig into the log and find that, some operations on theContactSelf
was triggered, and since the bot is logged out, error thrown out.Here is the code in
wechaty-puppet
that trigger the error:It's totally okay for it throw such error message out, but when using it in wechaty, like this:
An error with message
not logged in, no this.id yet.
will be printed out in the console, and to whom are writing bot with wechaty, they will treat this error message as "system message" (which means thrown out by wechaty and should be handled by wechaty)So I suggest to have a better error message here, to indicate that what operation failed and for what reason that the operation failed. I will submit a PR later to illustrate my proposal.
The text was updated successfully, but these errors were encountered: