Promise.all容错处理

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容错处理)