package com.netflix.utils; import rx.Observable; import rx.functions.Func1; public class RxUtils { public static T getSingleValueWithRealErrorCause(Observable observable) throws Exception { return observable.onErrorResumeNext(new Func1>(){ @Override public Observable call(Throwable t1) { if ((t1 instanceof RuntimeException) && t1.getCause() != null) { return Observable.error(t1.getCause()); } else { return Observable.error(t1); } } }).toBlockingObservable().single(); } }