【发布时间】:2020-01-03 02:50:43
【问题描述】:
我试图将可观察管道中的超时错误作为错误抛出给观察者,但我仍然在 val 回调(订阅中)中收到超时错误,而我想在错误回调中得到它:
对于谁进行实验,您可以在此链接中轻松测试此代码并在 stackblitz 中对其进行编辑:
https://stackblitz.com/edit/typescript-eegqyz?file=index.ts&devtoolsheight=100
of(4000, 3000, 2000)
.pipe(
concatMap(duration =>
makeRequest(duration).pipe(
timeout(2500),
catchError(error => {
//throwError('Valid token not returned');
return of(`Request timed out after: ${duration}`)
})
)
)
)
.subscribe(
val => console.log(val),
error => console.log("error", error)
);
【问题讨论】:
标签: angular rxjs observable rxjs6 redux-observable