Two or more requests are sent simultaneously inside Promise.all
. Then their responses are handled appropriately. But in case one of them is failed the rest of results is lost.
async init function ()
const [userInfo, balance] =
await Promise.all([
Promise.reject('get user info error'), // getUserInfo(),
Promise.resolve(5000) // getBalance()
])
this.userInfo = userInfo
this.balance = balance // it won't be initialized
}
Can that be handled without rewriting above code to old promise .. then().catch() style?