ReactiveX / RxSwift

Reactive Programming in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: relays .asInfallible()

mashe opened this issue · comments

commented

Hello,

I have played around with Infallible and noticed that neither of Relays (PublishRelay, BehaviorRelay nor ReplayRelay) could not be converted into a Infallible without providing a fallback. Relays never end or emit error so I guess it is fine to be converted into Infallible with asInfallible().

What do you think? Am I missing something?

I think this is an interesting idea but I'll need some more time to think about it to make sure there aren't any obvious issues around this that I'm missing. Thanks for the idea and PR!

I second this! I am currently converting Observable objects to Infallible in our application, but in some instances I can't easily because Relays don't convert to Infallible.
In some cases I've used asInfallible(onErrorRecover:) to log the impossible error and then return Infallible.empty() to continue.

I'm closing this, we can keep discussing in #2430. Thanks!