After reviewing the axios documentation, I placed the catch block following my request. However, despite catching and displaying the error in an Alert, the browser console still shows the message:
POST http://localhost:5000 403 (Forbidden) spread.js:25
I'm wondering why this message is appearing. Is it a 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');