DEV Community

Discussion on: Deep dive into Asynchronous Javascript

Collapse
 
stagefright5 profile image
stagefright5

You can also handle the error without try block like this:

const response = await fetch("http://invalidUrl").catch(console.error)
Enter fullscreen mode Exit fullscreen mode