-
Notifications
You must be signed in to change notification settings - Fork 4
UnhandledPromiseRejectionWarning on invalid url #3
Copy link
Copy link
Open
Description
Probably the same as #2, but to provide more detail:
Here's a snippet of the code I'm running:
try {
let url = 'http://googlecom'; // <-- invalid for the demonstration
const siteInfo = await openGraph.getSiteInfo(url);
console.log(siteInfo); // => undefined
} catch (error) {
console.error(error); // never runs
}
What's worth noting is:
- siteInfo resolves to
undefined - I get an
UnhandledPromiseRejectionWarningfrom node - this code does handle the promise rejection correctly, so I suspect this library doesn't.
Here's a screen shot of the error I get:

In particular, note the warnings:
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(). (rejection id: 1)
and
[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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels