Table of Contents

Class ThrowIfEmptyOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Extension methods implementing the throwIfEmpty operator.

public static class ThrowIfEmptyOperator
Inheritance
System.Object
ThrowIfEmptyOperator

Methods

ThrowIfEmpty<T>(Observable<T>, Func<Exception>?)

Mirrors source, but if it completes without ever emitting a value, the output errors instead of completing. If at least one value was emitted, the output completes normally.

public static Observable<T> ThrowIfEmpty<T>(this Observable<T> source, Func<Exception>? errorFactory = null)

Parameters

source Observable<T>

The source sequence.

errorFactory Func<Exception>?

An optional factory invoked to create the exception to emit if source completes without emitting a value. Defaults to a new EmptyErrorException.

Returns

Observable<T>

An observable that mirrors source, except that an empty completion is replaced with an error produced by errorFactory.

Type Parameters

T

The type of values emitted by source.