Skip to content

How to receive values from observable after an error #6992

Answered by voliva
jorroll asked this question in Q&A
Discussion options

You must be logged in to vote

how is CURRENT_USER$ defined?

In RxJS by default observables are lazy and unicast, meaning each subscriber will have their own side effect / state. When an observable throws an error, this error gets propagated all the way down to all subscribers, and all of those subscriptions are closed. As I understand, errors in RxJS were designed in a similar way of a regular throw new Error()... that process is killed. You can catch the error and recover from it, but whatever happened there it's now dead.

If CURRENT_USER$ is not multicast, then even though it didn't throw an error, its only subscription did, which caused an unsubscription throughout the whole chain.

A posible "simple" solution is to…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jorroll
Comment options

@jorroll
Comment options

Answer selected by jorroll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants