Please use hu.akarnokd.rxjava2.debug.RxJavaAssemblyTracking instead.
RxJava is not good when it comes to stack-traces. When we use observeOn
or subscribeOn
we get our stack-trace from the process root, erasing previous call history.
RxJavaStackTracer
seems to help. Especially for the existing projects. Because it provides no code invasion.
Register RxJavaStackTracer to RxJavaPlugins during creation of you app only once.
public class MyApp extends Application {
@Override
public void onCreate() {
RxJavaPlugins.getInstance()
.registerObservableExecutionHook(new RxJavaStackTracer());
}
}
After that, when an Exception occurs, its stack trace will derive not only from the exact position but from where an Observable is subscribed, even if working threads were switched using observeOn(), subscribeOn().
The inner static class OperatorTraceOnError
comes from konmik's solution in RxJava issue #3521.