Answer the question
In order to leave comments, you need to log in
How to catch Rx.js stream error in one pipe?
I use a homemade analogue of Ngrx in my project, I send a link to its prototype below (stackblitz).
https://stackblitz.com/edit/rxjs-qy2jk8
I don't want to handle an error in every action, actions are Subjects that are inside the merge. Then I also
add reduced to this pipe via the scan operator.
I would like to handle errors in actions in one place using one catchError.
In line 21, if you uncomment the code, then the Alex action will be executed, And for the rest of the pipe, the stack will fall
actions$.next({ userName: "Alex" }); // If someActionWithError$ throws Error
// Other dispatches dont work
actions$.next({ userName: "SomeOtherName" });
actions$.next({ userName: "SomeOtherName2" });
actions$.next({ userName: "SomeOtherName3" });
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question