Handling errors when awaiting an async function

So far in this chapter, we've seen how to work with async functions that fulfill successfully. But, as we know, this is not always the case. We need to be able to handle errors that are thrown by asynchronous functions, or any functions they call.

In this recipe, we'll see how try-catch blocks can handle errors that are thrown by async functions.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.