<PackageReference Include="System.Reactive" Version="6.0.0-preview.16" />

Catch<TSource>

sealed class Catch<TSource> : Producer<TSource, _<TSource>>
using System.Collections.Generic; using System.Runtime.CompilerServices; namespace System.Reactive.Linq.ObservableImpl { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1, 1 })] internal sealed class Catch<[System.Runtime.CompilerServices.Nullable(2)] TSource> : Producer<TSource, Catch<TSource>._> { [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] internal sealed class _ : TailRecursiveSink<TSource> { [System.Runtime.CompilerServices.Nullable(2)] private Exception _lastException; public _(IObserver<TSource> observer) : base(observer) { } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1 })] protected override IEnumerable<IObservable<TSource>> Extract(IObservable<TSource> source) { return (source as Catch<TSource>)?._sources; } public override void OnError(Exception error) { _lastException = error; Recurse(); } protected override void Done() { if (_lastException != null) ForwardOnError(_lastException); else ForwardOnCompleted(); } protected override bool Fail(Exception error) { OnError(error); return true; } } private readonly IEnumerable<IObservable<TSource>> _sources; public Catch(IEnumerable<IObservable<TSource>> sources) { _sources = sources; } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0 })] protected override _ CreateSink(IObserver<TSource> observer) { return new _(observer); } protected override void Run([System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0 })] _ sink) { sink.Run(_sources); } } }