-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Error Handling Operators
David Gross edited this page Jan 12, 2015
·
29 revisions
There are a variety of operators that you can use to react to or recover from onError
notifications from Observables. For example, you might:
- swallow the error and switch over to a backup Observable to continue the sequence
- swallow the error and emit a default item
- swallow the error and immediately try to restart the failed Observable
- swallow the error and try to restart the failed Observable after some back-off interval
The following pages explain these operators.
-
onErrorResumeNext( )
— instructs an Observable to emit a sequence of items if it encounters an error -
onErrorReturn( )
— instructs an Observable to emit a particular item when it encounters an error -
onExceptionResumeNext( )
— instructs an Observable to continue emitting items after it encounters an exception (but not another variety of throwable) -
retry( )
— if a source Observable emits an error, resubscribe to it in the hopes that it will complete without error -
retryWhen( )
— if a source Observable emits an error, pass that error to another Observable to determine whether to resubscribe to the source
Copyright (c) 2016-present, RxJava Contributors.
Twitter @RxJava | Gitter @RxJava