为什么Axios记录错误403,即使我抓住它

问题描述 投票:0回答:1

基于axios docs,我在我的请求之后有了catch块,但即使我捕获错误并显示Alert,在浏览器控制台上我收到了消息:

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

为什么上面的消息?这是默认的浏览器行为吗?

客户:

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

服务器:

res.status(403).send('Error message');
javascript express axios
1个回答
0
投票

是的,默认情况下,Chrome会记录每个失败的http请求。

© www.soinside.com 2019 - 2024. All rights reserved.