Axios call error handling

If I have the following Axios call and if my request request returns 401 or 403 status code. Then, is the call going to end up inside the catch (err => block?

axios.get('/my-highly-available-api').then(response => `{ // do stuff ` }) .catch(err => `{ // what now? ` console.log(err); `` })

You can test what happens yourself using this site:

https://httpstat.us/

This is a simple service for generating different HTTP codes.

So, in your case, make calls to the following endpoints:

3 Likes

Thanks

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.