Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 1.19 KB

File metadata and controls

23 lines (17 loc) · 1.19 KB

DEPRECATED

Please use hu.akarnokd.rxjava2.debug.RxJavaAssemblyTracking instead.

RxJavaStackTracer

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.

Usage

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().

Thanks

The inner static class OperatorTraceOnError comes from konmik's solution in RxJava issue #3521.