rma
rma

Reputation: 177

Why Axios logs error 403 even when I catch it

Based on axios docs, I have the catch block after my request, but even I catching the error and showing the Alert, on browsers console I got the message:

POST http://localhost:5000 403 (Forbidden)      spread.js:25

Why the message above ? Is this the default browser behavior ?

Client:

axios.get('/user?ID=12345')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    alert(error);
  });

Server:

res.status(403).send('Error message');

Upvotes: 1

Views: 1815

Answers (1)

Wojtek
Wojtek

Reputation: 439

Yes, at least Chrome by default logs every failed http request.

Upvotes: 1

Related Questions