question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stop closing Issues without a solution, reason or response => Unhandled rejection on sendContactVcard

See original GitHub issue

Please 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

  1. 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:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
foomotocommented, Nov 30, 2021

This are the early signs that an open source project is failing

0reactions
jamesxt94commented, Dec 1, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found