Skip to content

Crashing while calling LogDna.log #5

Open
@RethinavelPillai

Description

@RethinavelPillai
com.mazenrashed.logdnaandroidclient.LogDna$log$1.accept (LogDna.java:47)
com.mazenrashed.logdnaandroidclient.LogDna$log$1.accept (LogDna.java:15)
io.reactivex.internal.observers.ConsumerSingleObserver.onSuccess (ConsumerSingleObserver.java:62)
io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.onSuccess (SingleSubscribeOn.java:68)
io.reactivex.internal.operators.observable.ObservableSingleSingle$SingleElementObserver.onComplete (ObservableSingleSingle.java:109)
retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual (CallExecuteObservable.java:52)
io.reactivex.Observable.subscribe (Observable.java:12284)
io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual (ObservableSingleSingle.java:35)
io.reactivex.Single.subscribe (Single.java:3666)
io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run (SingleSubscribeOn.java:89)
io.reactivex.Scheduler$DisposeTask.run (Scheduler.java:608)
io.reactivex.internal.schedulers.ScheduledRunnable.run (ScheduledRunnable.java:66)
io.reactivex.internal.schedulers.ScheduledRunnable.call (ScheduledRunnable.java:57)

Possible Solution :

 
dispose of a stream that uses subscribeOn also disposes of the thread used. This also involves calling Thread.interrupt() when using Schedulers.io(). This causes the exception in your case.
InterruptedException is an Exception thrown by Thread.sleep, so it is caught by your code and passed to onError like any other exception.
Calling onError after dispose redirects the error to the global error handler due to RxJava2's policy of NEVER throwing away errors. To work around this check subscriber.isDisposed() before calling onError or use RxJava 2.1.1's new subscriber.tryOnError.

if (!subscriber.isDisposed()) {
  subscriber.onError(exception)

}```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions