Class OperatorOnErrorResumeNextViaFunction<T>
- java.lang.Object
-
- rx.internal.operators.OperatorOnErrorResumeNextViaFunction<T>
-
- Type Parameters:
T
- the value type
- All Implemented Interfaces:
Func1<Subscriber<? super T>,Subscriber<? super T>>
,Function
,Observable.Operator<T,T>
public final class OperatorOnErrorResumeNextViaFunction<T> extends java.lang.Object implements Observable.Operator<T,T>
Instruct an Observable to pass control to another Observable (the return value of a function) rather than invokingonError
if it encounters an error.By default, when an Observable encounters an error that prevents it from emitting the expected item to its Observer, the Observable invokes its Observer's
onError
method, and then quits without invoking any more of its Observer's methods. TheonErrorResumeNext
operation changes this behavior. If you pass a function that returns an Observable (resumeFunction
) toonErrorResumeNext
, if the source Observable encounters an error, instead of invoking its Observer'sonError
method, it will instead relinquish control to this new Observable, which will invoke the Observer'sonNext
method if it is able to do so. In such a case, because no Observable necessarily invokesonError
, the Observer may never know that an error happened.You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Func1<java.lang.Throwable,? extends Observable<? extends T>>
resumeFunction
-
Constructor Summary
Constructors Constructor Description OperatorOnErrorResumeNextViaFunction(Func1<java.lang.Throwable,? extends Observable<? extends T>> f)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Subscriber<? super T>
call(Subscriber<? super T> child)
static <T> OperatorOnErrorResumeNextViaFunction<T>
withException(Observable<? extends T> other)
static <T> OperatorOnErrorResumeNextViaFunction<T>
withOther(Observable<? extends T> other)
static <T> OperatorOnErrorResumeNextViaFunction<T>
withSingle(Func1<java.lang.Throwable,? extends T> resumeFunction)
-
-
-
Field Detail
-
resumeFunction
final Func1<java.lang.Throwable,? extends Observable<? extends T>> resumeFunction
-
-
Constructor Detail
-
OperatorOnErrorResumeNextViaFunction
public OperatorOnErrorResumeNextViaFunction(Func1<java.lang.Throwable,? extends Observable<? extends T>> f)
-
-
Method Detail
-
withSingle
public static <T> OperatorOnErrorResumeNextViaFunction<T> withSingle(Func1<java.lang.Throwable,? extends T> resumeFunction)
-
withOther
public static <T> OperatorOnErrorResumeNextViaFunction<T> withOther(Observable<? extends T> other)
-
withException
public static <T> OperatorOnErrorResumeNextViaFunction<T> withException(Observable<? extends T> other)
-
call
public Subscriber<? super T> call(Subscriber<? super T> child)
- Specified by:
call
in interfaceFunc1<Subscriber<? super T>,Subscriber<? super T>>
-
-