Skip to content

Observable.Throw(Exception) method

Defined in

Type: Observable Namespace: System.Reactive.Linq Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static IObservable<TResult> Throw<TResult>(Exception exception)
  • 2. public static IObservable<TResult> Throw<TResult>(Exception exception, TResult witness)
  • 3. public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler)
  • 4. public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler, TResult witness)

1. Overload

public static IObservable<TResult> Throw<TResult>(Exception exception)

Summary: Returns an observable sequence that terminates with an exception.

Type parameters

NameDescription
TResultThe type used for the IObservable type parameter of the resulting sequence.

Parameters

NameTypeDescription
exceptionExceptionException object used for the sequence's termination.

Returns: IObservable -- The observable sequence that terminates exceptionally with the specified exception object.

Exceptions

TypeCondition
System.ArgumentNullExceptionexception is null.

2. Overload

public static IObservable<TResult> Throw<TResult>(Exception exception, TResult witness)

Summary: Returns an observable sequence that terminates with an exception.

Type parameters

NameDescription
TResultThe type used for the IObservable type parameter of the resulting sequence.

Parameters

NameTypeDescription
exceptionExceptionException object used for the sequence's termination.
witnessTResultObject solely used to infer the type of the TResult type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.

Returns: IObservable -- The observable sequence that terminates exceptionally with the specified exception object.

Exceptions

TypeCondition
System.ArgumentNullExceptionexception is null.

3. Overload

public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler)

Summary: Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.

Type parameters

NameDescription
TResultThe type used for the IObservable type parameter of the resulting sequence.

Parameters

NameTypeDescription
exceptionExceptionException object used for the sequence's termination.
scheduler[IScheduler](#Scheduler to send the exceptional termination call on.

Returns: IObservable -- The observable sequence that terminates exceptionally with the specified exception object.

Exceptions

TypeCondition
System.ArgumentNullExceptionexception or scheduler is null.

4. Overload

public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler, TResult witness)

Summary: Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.

Type parameters

NameDescription
TResultThe type used for the IObservable type parameter of the resulting sequence.

Parameters

NameTypeDescription
exceptionExceptionException object used for the sequence's termination.
scheduler[IScheduler](#Scheduler to send the exceptional termination call on.
witnessTResultObject solely used to infer the type of the TResult type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.

Returns: IObservable -- The observable sequence that terminates exceptionally with the specified exception object.

Exceptions

TypeCondition
System.ArgumentNullExceptionexception or scheduler is null.