Angular 显示错误并恢复流

Angular 显示错误并恢复流,angular,react-native,stream,rxjs,reactjs-flux,Angular,React Native,Stream,Rxjs,Reactjs Flux,我有一个实时搜索,但如果由于某种原因forkJoin失败,一切都会停止工作。错误后我试图查找的任何新词都不起作用。如何显示错误并正常恢复流,以便搜索其他单词 this.search$ .distinctUntilChanged() .switchMap((query) => Rx.Observable.forkJoin(sources)) // If this fails the search stops working .subscribe((results) => c

我有一个实时搜索,但如果由于某种原因forkJoin失败,一切都会停止工作。错误后我试图查找的任何新词都不起作用。如何显示错误并正常恢复流,以便搜索其他单词

this.search$
  .distinctUntilChanged()
  .switchMap((query) => Rx.Observable.forkJoin(sources)) // If this fails the search stops working
  .subscribe((results) => console.log(results));
试试这个:

this.search$
.distinctUntilChanged()
.switchMap((查询)=>Rx.Observable.forkJoin(源)
//返回空结果对象,我使用了空数组。。。
.catch(错误=>可观察到的([]))
.subscribe((结果)=>console.log(结果));

请注意,
catch()
forkJoin()
上,而不是在
switchMap()
上。…

我还需要显示错误,是否将其也放在catch中?