There are a variety of operators that you can use to react to or recover from onError notifications from Observables. For example, you might:

  1. swallow the error and switch over to a backup Observable to continue the sequence
  2. swallow the error and emit a default item
  3. swallow the error and immediately try to restart the failed Observable
  4. 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