How to do some action if error happen in stream, but continue to receive new items? For example, I need to just logging error, but continue to receive data from server. I tried a lot of solutions from stackoverflow, but stream always behave like closed.
答案 0 :(得分:1)
The solution is quite easy:
const frontendMessagesStream = new Subject<FrontendMessage>()
frontendMessagesStream
.pipe(
tap(console.log),
map(someThrow),
tap(console.log),
catchError((err, o) => o), // the second parameter will be your observable. It replaces your stream.
)
.subscribe()