I am using Retrofit to access my API as follows:
public interface UserService {
...
@POST(\"/user/login\")
public Observable register(@Bo
you can use unsafe unsafeSubscribe.
...
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.unsafeSubscribe(new Observer<User>() {
@Override
public void onCompleted() {
....
}
@Override
public void onError(Throwable e) {
....
}
@Override
public void onNext(User user) {
....
}
});
...
In my previous experience with RxJava the OnErrorFailedException means that an exception occurred while handling another exception in the onError method.
If you don't see stack trace of the real cause it's probably due the bug in RxJava with CompositeException (versions 0.19.2 and above) https://github.com/Netflix/RxJava/issues/1405
As a workaround try to wrap your onError code within try-catch block and log the exception. This way you will see what's the problem with your onError implementation and you will be able to solve the problem.
@Override
public void onError(Throwable e) {
try {
...
catch(Throwable e) {
// Log the exception
}
}