Stop closing Issues without a solution, reason or response => Unhandled rejection on sendContactVcard
See original GitHub issuePlease stop closing issues without any solution, reason or response.
This is a real bug. The library should reject the promise, in that way user code can control it, instead of generating an unhandled rejection when receiving invalid parameters. Here the original issue closed without response: #1302
Description
Unhandled rejection, and promise never rejected or resolved on sendContactVcard when invalid parameters.
Environment
- Venom version(s): 4.0.2
- Browser: Not relevant in this bug, but using Chrome 96
- OS: Linux, Ubuntu 21.04
- Node version: Node 14
Steps to Reproduce
- Send invalid parameters to method sendContactVcard. For example send any text instead of a contactId
Your Code
await client.sendContactVcard("xxxxx@c.us", ["Not a correct contactId"])
Additional context / Screenshot
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'erro' of undefined
at Whatsapp.<anonymous> (/root/.kawi/packages/2afa2f5f633a45ca784c30c32efeead6/node_modules/venom-bot/dist/api/layers/sender.layer.js:874:47)
at step (/root/.kawi/packages/2afa2f5f633a45ca784c30c32efeead6/node_modules/venom-bot/dist/api/layers/sender.layer.js:48:23)
at Object.next (/root/.kawi/packages/2afa2f5f633a45ca784c30c32efeead6/node_modules/venom-bot/dist/api/layers/sender.layer.js:29:53)
at fulfilled (/root/.kawi/packages/2afa2f5f633a45ca784c30c32efeead6/node_modules/venom-bot/dist/api/layers/sender.layer.js:20:58)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
I think can be solved checking result
is an object, if not reject the promise with InvalidParameter exception or similar.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Top Results From Across the Web
resolver or addr is not configured for ENS name (argument ...
Hi! I run this code in browser, and can't catch promise rejection. Important: I added await before getContract,however in typings you return Contract,...
Read more >Unhandled Rejection: Headers cant be set after they are sent
The problem is that the yourFunctionHandler(agent) function is doing things asynchronously, but isn't returning a Promise.
Read more >Handling those unhandled promise rejections with JS async ...
In the first case, the key is this part of the error message: … by rejecting a promise which was not handled with...
Read more >Possible unhandled promise rejection typeerror network ...
On average issues are closed in 148 days. the error and either fail silently (if the failing API request is Unhandled promise rejection...
Read more >A Comprehensive Guide To Error Handling In Node.js
Errors happen in every application. Devs have to decide: do you write code to handle the error? Suppress it? Notify the user?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This are the early signs that an open source project is failing
The only mistake in this bug is in title: Unhandled rejection is not the correct term, should be: Unhandled exception and can kill the entire app. But the report is perfectly valid.