美文网首页
Promise.all容错处理

Promise.all容错处理

作者: 杜乡的AGG | 来源:发表于2020-04-23 17:48 被阅读0次
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容错处理

      本文链接:https://www.haomeiwen.com/subject/raoaihtx.html