Javascript 在角度模式下使用ngrx时捕获超时错误

Javascript 在角度模式下使用ngrx时捕获超时错误,javascript,angular,redux,rxjs,ngrx,Javascript,Angular,Redux,Rxjs,Ngrx,我想在发出Http请求时处理超时错误 这是我的效果 loadSchedulings$ = createEffect(() => this.actions$.pipe( ofType(ESchedulesActions.GetSchedulesByDate), mergeMap(() => this.apiCallsService.getSchedulings().pipe( map(trips => ({ type: ESched

我想在发出Http请求时处理超时错误

这是我的效果

loadSchedulings$ = createEffect(() =>
  this.actions$.pipe(
    ofType(ESchedulesActions.GetSchedulesByDate),
    mergeMap(() =>
      this.apiCallsService.getSchedulings().pipe(
        map(trips => ({ type: ESchedulesActions.GetSchedulesByDateSuccess, payload: trips })),
        catchError(err => {
          console.log(err);
          return EMPTY;
        })
      )
    )
  )
);
这是我的
getSchedulingService

getSchedulings() {
  return this.http.get<ISchedules>(this.urlData).pipe(
    map(data => {
      ...
      return groupByDate;
    }),
    timeout(2500),
    catchError(error => of(`Request timed out`))
  );
}
getSchedulings(){
返回this.http.get(this.urlData).pipe(
地图(数据=>{
...
返回groupByDate;
}),
超时(2500),
catchError(error=>of(`Request timed out`))
);
}
实际上,在我的效果中,
catchError
不会捕获任何错误,但是我在我的服务函数中发送了错误


如何使用rxjs操作符来实现这一点?

我的看法是,您将在getSchedulings()调用中捕获错误,并且您从不传播此错误,而是返回一个新的可观察到的错误。尝试使用投掷者替换of:

    catchError(error => throwError(`Request timed out`))
这将依次由您的效果处理