也许我误解了如何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。
async () => {
let response
try {
let response = await fetch('not-a-real-url')
}
catch (err) {
// not jumping in here.
console.log(err)
}
}()