Can I capture an external async function unhandled error?

Let’s suppose I want to use an async function foo from an external library, which calls another async function bar that throws an error that foo does not handle:

// External library code (non-modifiable)

async function bar(){
  throw Error("Error example");
}

async function foo() {
  bar()
}

If in my code I want to use foo, is there any way I can handle the error thrown by bar? This does not work, as foo does not await for bar:

// My code

async function myMain(){
  try {
    await foo();
  } catch (error) {
    console.log("Error captured in myMain:", error.message);
  }
}