P
P
Pantene7422020-06-10 23:41:25
JavaScript
Pantene742, 2020-06-10 23:41:25

How to catch an error in the parent Subject pipe in Rx.js?

https://stackblitz.com/edit/rxjs-jyrfi7?devtoolshe...
In the example above, I have rootSubjec$ = Subject from which other streams are inherited, as in the code example - const firstChildStream$ = rootSubjec$.pipe

There may be an error in these streams in the pipe and then the whole stream merged$ where

merged$ = merge(rootSubjec$, firstChildStream$, secondChildStream$)

I can handle the error in each child stream (line 28 is commented out), But is it possible to somehow handle the error in the root stream in one place ? so as not to repeat the http request error maintenance code in each child stream?

On the basis of this code, I have built an Ngrx type store - this is the problematic part taken out of context.
There will be a lot of repeated code if I handle an error in each Http Action, There are 100500 of them.
I would like to somehow put a pipe operator in the root stream and handle all the errors that may be
in child streams there

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question