iex
12/02/2020, 2:41 PMSingle with success/error state. Thinking about how to implement this. Something like
val successObservable: Observable<SomeType>
val errorObservable: Observable<AnotherType> // AnotherType can be mapped into a Throwable
request.flatMap {
// First event of successObservable OR errorObservable. successObservable -> just(event), errorObservable -> error(error)
}
Not sure what operators to use here, zip with take(1) and startsWith(none) crossed my mind but it doesn't feel right...MiSikora
12/02/2020, 10:55 PMsuccessObservable.ambWith(errorObservable).firstOrError()iex
12/03/2020, 1:11 PMamb. Need to map the observables too to Result (or another common type), since amb requires the types to be the sameiex
12/03/2020, 1:12 PMflatMap to map the result.success to .just and result.error to .error