Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wechaty process.exit(1) if token is not valid #1811

Closed
andriipustovoit opened this issue Jul 10, 2019 · 1 comment
Closed

Wechaty process.exit(1) if token is not valid #1811

andriipustovoit opened this issue Jul 10, 2019 · 1 comment

Comments

@andriipustovoit
Copy link

andriipustovoit commented Jul 10, 2019

In Nodejs application, I want to start multiple Wechaty PuppetPadpro bot instances dynamically based on an HTTP request. A token for a new instance of Wechaty bot is passed along with the request. But if for some reason not a valid token is passed to Wechaty bot, library prints error and calls process process.exit(-1); which stops the whole Nodejs process with multiple running bot instances. Can somehow I modify Wechaty bot behavior to not perform process.exit(-1); but just print error instead?

I tried to catch errors from
bot.start().catch(error => console.log("error"));
tried to wrap into Domain to catch errors, but nothing seems to work.

Message that I receive:

  The token is invalid, please use an valid token to access padchat
  If you have question about this, please check out our wiki:
  https://github.com/botorange/wechaty-puppet-padpro/wiki/Buy-Padpro-Token

  你使用的Token是无效的,请你联系我们获取有效Token,详情请参考这个页面:
  https://github.com/botorange/wechaty-puppet-padpro/wiki/%E8%B4%AD%E4%B9%B0token

I expect bot just emits error event on an invalid token, but instead, bot terminates Nodejs process.

P.S. thought about posting question to stack overflow as was recommended but got an error on:
Creating the new tag 'wechaty' requires at least 1500 reputation. Try something from the existing tags list instead.

@andriipustovoit
Copy link
Author

It seems the question should be forwarded to puppet implementation: wechaty/wechaty-puppet-padpro#157

Closing ticket here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant