I'm running a whatsapp bot and everything works fine until I get a message
at /root/bot/node_modules/@adiwajshing/baileys/lib/Utils/generics.js:157:32
(node:26706)
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: 21)
I tried to search for some answers on the ChatGPT bot but that's not working, maybe someone can help me to fix this issue. Here is the code
// Create a promise that rejects in <ms> milliseconds
const { delay, cancel } = (0, exports.delayCancellable)(ms);
const p = new Promise((resolve, reject) => {
delay
.then(() => reject(new boom_1.Boom('Timed Out', {
statusCode: Types_1.DisconnectReason.timedOut,
data: {
stack
}
})))
.catch(err => reject(err));
promise(resolve, reject);
})
.finally(cancel);
return p;
}
Note: code at
root/bot/node_modules/@adiwajshing/baileys/lib/Utils/generics.js:157
is
.then(() => reject(new boom_1.Boom('Timed Out', {