puppet-wechat
puppet-wechat copied to clipboard
Nudge (拍一拍) Message Cause Error
Description
When anyone nudges (拍一拍) anyone in a group, an error will be thrown (even not terminate the process).
Environments
- Wechaty 0.40.10
- wechaty-puppet-puppeteer (default)
- Node.js v12.16.2
- Windows 10, 1909, 18363
Log
(node:2596) UnhandledPromiseRejectionWarning: Error: not found
at PuppetPuppeteer.<anonymous> ([project-path]\node_modules\wechaty\node_modules\wechaty-puppet-puppeteer\src\puppet-puppeteer.ts:998:13)
at Generator.next (<anonymous>)
at fulfilled ([project-path]\node_modules\wechaty\node_modules\wechaty-puppet-puppeteer\dist\src\puppet-puppeteer.js:23:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:2596) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2596) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future,
promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I have located the bug.
bot.on('message', (m) => {
const one = m.from();
const room = m.room();
if (room) {
room.alias(one).then((data) => {
// get sender's alias in room
}).catch((error) => {
// nudge (拍一拍) message causes error
})
}
});
Good catch, and thank you very much for pointing out where the problem is!
A PR for fixing this issue is welcome.