Skip to content

UnhandledPromiseRejectionWarning on invalid url #3

@sseppola

Description

@sseppola

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 UnhandledPromiseRejectionWarning from 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:
Screenshot 2019-10-31 at 14 49 58

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions