6
也许我误解了async/await
如何捕捉错误应该从像这样的文章https://jakearchibald.com/2014/es7-async-functions/和这个http://pouchdb.com/2015/03/05/taming-the-async-beast-with-es7.html工作,但我的catch
块没有捕获400/500。try..catch不捕捉异步/等待错误
async() => {
let response
try {
let response = await fetch('not-a-real-url')
}
catch (err) {
// not jumping in here.
console.log(err)
}
}()
example on codepen if it helps
阿法克的提取API不considter 400/500错误 – VeXii