Previous Page

Q:- How to handle error/exception with Async/Await in Node.js?

Using async/await, you still need to catch errors.

async function someFunction() {
  try {
    await someOtherFunction()
  }
  catch (err) {
    console.error(err.message)
  }
}
Previous Page