public ValueTask SubscribeAsync(IAsyncObserver <T> observer) { var obs = default(IAsyncObservable <T>); try { obs = _factory(); } catch (Exception error) { obs = AsyncObservable.Throw <T>(error); } return(obs.SubscribeAsync(observer)); }
public async ValueTask SubscribeAsync(IAsyncObserver <T> observer) { var obs = default(IAsyncObservable <T>); try { obs = await _factory().ConfigureAwait(false); } catch (Exception error) { obs = AsyncObservable.Throw <T>(error); } await obs.SubscribeAsync(observer).ConfigureAwait(false); }
public ValueTask SubscribeAsync(IAsyncObserver <TResult> observer) { IAsyncObservable <TResult> source; try { var resource = _resourceFactory(); source = _observableFactory(resource).Finally(() => resource.Dispose()); } catch (Exception ex) { source = AsyncObservable.Throw <TResult>(ex); } return(source.SubscribeAsync(observer)); }