https://speakerdeck.com/yuyakaido/droidkaigi-2017?slide=86
この辺の話に近い。
Observable.create<Int> { emitter -> emitter.onNext(1) emitter.onNext(2) emitter.onError(HogeException()) emitter.onComplete() }.retryWhen { observable -> observable.flatMap { e -> val exception = if (e is HogeException) FooException() else e Observable.error<Int>(exception) } }.subscribe({ println(it) }, { e -> println(e.javaClass.simpleName) }, {}) class HogeException : RuntimeException() class FooException : RuntimeException()
こんな感じでHogeExceptionが流れてきたら、FooExceptionにExceptionを変更して流す。
そんな1日だった。いや違うけど。