Created
October 1, 2018 12:46
-
-
Save gm4s/c0f0d1718d6170af57a037429af3ab60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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