Correctly handle error gracefully in the RxBus that receives information from the Node through graphenej, to avoid a crash.

This commit is contained in:
Severiano Jaramillo 2019-02-20 17:12:41 -06:00
parent 8d257876a0
commit 4ad841d525

View file

@ -9,6 +9,7 @@ import android.os.IBinder
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.crashlytics.android.Crashlytics
import cy.agorise.graphenej.api.ConnectionStatusUpdate import cy.agorise.graphenej.api.ConnectionStatusUpdate
import cy.agorise.graphenej.api.android.NetworkService import cy.agorise.graphenej.api.android.NetworkService
import cy.agorise.graphenej.api.android.RxBus import cy.agorise.graphenej.api.android.RxBus
@ -43,7 +44,10 @@ abstract class ConnectedFragment : Fragment(), ServiceConnection {
RxBus.getBusInstance() RxBus.getBusInstance()
.asFlowable() .asFlowable()
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe { handleIncomingMessage(it) } .subscribe(
{ handleIncomingMessage(it) } ,
{t -> Crashlytics.log(Log.DEBUG, TAG, t.message) }
)
) )
} }