This project has moved and is read-only. For the latest updates, please go here.

IObservable<Either<T, Exception>> conversion

Topics: Interactive (Ix), Reactive (Rx)
Apr 17, 2013 at 12:15 PM
so i have a subscription that returns IObservable<Either<T, Exception>> from an external source, and i would like to convert that into IObservable<Either<T, MyAppException>>, where MyAppException takes Exception as a parameter in ctor.

can you please advise a way of doing this? thanks
Apr 17, 2013 at 1:10 PM

You can use this overload of Select. It allows you to project both sides of Either.

For example:
IObservable<Either<T, Exception>> xs = GetObservableFromExternalSource();

IObservable<Either<T, MyAppException>> ys = xs.Select(t => t, ex => new MyAppException(ex));
See also:

- Dave
Apr 17, 2013 at 1:27 PM
Good stuff, worked, thanks