Skip to content

,--0)} ,System.Func{--1,--0})}

ReactiveExtensions.CatchAndReturn(IObservable, T) method

Defined in

Type: ReactiveExtensions Namespace: ReactiveUI.Extensions Assembly: ReactiveUI.Extensions.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Overloads

  • 1. public static IObservable<T> CatchAndReturn<T>(this IObservable<T> source, T fallback)
  • 2. public static IObservable<T> CatchAndReturn<T, TException>(this IObservable<T> source, Func<TException, T> fallbackFactory) where TException : Exception

1. Overload

public static IObservable<T> CatchAndReturn<T>(this IObservable<T> source, T fallback)

View source

Summary: Catches any error and returns a fallback value then completes.

Type parameters

NameDescription
TElement type.

Parameters

NameTypeDescription
sourceIObservableSource sequence.
fallbackTFallback value.

Returns: IObservable -- Sequence producing either original values or fallback on error then completing.

2. Overload

public static IObservable<T> CatchAndReturn<T, TException>(this IObservable<T> source, Func<TException, T> fallbackFactory) where TException : Exception

View source

Summary: Catches a specific exception type mapping it to a fallback value.

Type parameters

NameDescription
TElement type.
TExceptionException type.

Parameters

NameTypeDescription
sourceIObservableSource sequence.
fallbackFactoryFuncFactory producing fallback from the exception.

Returns: IObservable -- Recovered sequence.