DEV Community

Discussion on: Finally in Promises & Try/Catch

Collapse
 
revel109 profile image
Abu Yusuf

I would like work with my error.response/error.response.status in catch.
How to do that?

Collapse
 
antonitor profile image
Toni Torres

You'll have to throw new Error yourself in your try block, something like:
if (!response.ok) throw new Error("Ups!")