Skip to content

Instantly share code, notes, and snippets.

@gm4s
Created October 1, 2018 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gm4s/c0f0d1718d6170af57a037429af3ab60 to your computer and use it in GitHub Desktop.
Save gm4s/c0f0d1718d6170af57a037429af3ab60 to your computer and use it in GitHub Desktop.
class NeverErrorTransformer<T>(
private val errorAction: Consumer<Throwable>?
) : ObservableTransformer<T, T> {
constructor() : this(null)
override fun apply(upstream: Observable<T>): ObservableSource<T> {
return upstream
.doOnError { e: Throwable ->
Crashlytics.logException(e)
errorAction?.accept(e)
}
.onErrorResumeNext(Observable.empty())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment