如何在捕获错误后忽略错误并在 rxjs forkJoin 中执行最终结果?

How to ignore an error after catching it and execute final result in rxjs forkJoin?

   myfunc() { 
        const combined = forkJoin(

            this.service.fn1(parameter).pipe(
                catchError(err => {
                   throw (this.handleError(err));
                }),
            ),

            this.service2.fn2().pipe(
                catchError(err => 
                //i need to ignore this error and execute final result,
            ), 

            this.service3.fn3().pipe(
                catchError(err => // Need to ignore this error too and continue)
            ));

         const subscribe = combined.subscribe (
            ([fn1,fn2,fn3]) => {

               //execute this part even if fn2, fn3 call fails. How can i do ??     

          }    
     );
}

如何忽略我在 service2.fn2() 和 service3.fn3() 中捕获的错误并执行最后一部分?

我是新手,如有任何帮助,我们将不胜感激。

我看到这个 link 但我没完全理解。谁能简单的说一下就好了

http://jsbin.com/babirakiyi/1/edit?js,console

订阅方法接受 3 个函数参数,如您在他的实现中所见

subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;

使用第二个来处理你的错误

已更新

你的函数看起来像

myfunc() { 
const combined = forkJoin(
    this.service.fn1(parameter),
    this.service2.fn2(),
    this.service3.fn3())   

  const subscribe = combined.subscribe (
        ([fn1,fn2,fn3]) => {
           //execute this part even if fn2, fn3 call fails. How can i do ??     
      }, (err)=>{
          // here you can manage the side effect action
      }    
 );
}

如果抛出错误,将执行第二个函数

更新#2

如果您想独立处理错误,您可以捕获每个错误

       const combined = forkJoin(
        this.service.fn1(parameter).catch((err)=>{ 
        // do your side effect 
        return Observable.of(undefined) 
        }),
        this.service2.fn2().catch(/** same idea*/),
        this.service3.fn3().catch(/** same idea*/)) 

请注意,对于每个失败的可观察对象,您将在订阅数组上收到未定义的消息