【发布时间】:2018-07-18 18:22:30
【问题描述】:
我正在使用流行库“axios”的 .all 方法来处理我的 ajax 请求。
但是如果所有请求都得到 404,我该如何处理错误呢?
例如:
axios.all([
axios.get('http://some_url'),
axios.get('http://another_url'),
])
.then(axios.spread((someUrl, anotherUrl) => {
// ... boring stuff goes there
}))
.catch(() => {
//... error goes there
});
所以,似乎只有一个错误被“捕获”了。
我怎样才能全部抓到?或者也许有任何一种.finally?
【问题讨论】:
标签: javascript ajax axios