也许我误解了如何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)
}
}()