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:

This is a simple service for generating different HTTP codes.

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

3 Likes

Thanks