Observer.onError firing off inconsistently

前端 未结 2 998

I am using Retrofit to access my API as follows:

public interface UserService {
    ...
    @POST(\"/user/login\")
    public Observable register(@Bo         


        
2条回答
  •  情书的邮戳
    2021-02-14 10:08

    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
       }
    }
    

提交回复
热议问题