const promiseArray = [
Service.getComprehensive(),
Service.getWorkFormStatistics()
]
// 容错处理
const handlePromise = Promise.all(
promiseArray.map((promiseItem: any) => {
return promiseItem.catch((err: Error) => {
return err
})
})
)
handlePromise
.then((res: any) => {
})
.catch((err: Error) => {
$this._tipErr(err)
})
}
Promise.all容错处理
推荐阅读更多精彩内容
- Promise.all()接受一个由promise任务组成的数组,可以同时处理多个promise任务,当所有的任务...
- 背景: promise.all中任何一个promise 出现错误的时候都会执行reject,导致其它正常返回的数据...
- 2020年3月11日《每日一题系列🚀》作者:王二狗博客:掘金、思否、知乎、简书、CSDN 点赞再看,养成习...
- #promise.all()与promise.race() Promise.all()方法可以把多个promise...