Merge branch 'develop' of github.com:Agorise/bitsy-wallet into develop

This commit is contained in:
Severiano Jaramillo 2019-01-31 15:00:46 -06:00
commit 980517c168

View file

@ -147,7 +147,11 @@ abstract class ConnectedActivity : AppCompatActivity(), ServiceConnection {
mDisposable = RxBus.getBusInstance()
.asFlowable()
.observeOn(AndroidSchedulers.mainThread())
.subscribe { handleIncomingMessage(it) }
.subscribe({
this.handleIncomingMessage(it)
}, {
this.handleError(it)
})
}
/**
@ -161,6 +165,19 @@ abstract class ConnectedActivity : AppCompatActivity(), ServiceConnection {
mCurrentAccount = UserAccount(userId)
}
/**
* Error consumer used to handle potential errors caused by the NetworkService while processing
* incoming data.
*/
private fun handleError(throwable: Throwable){
Log.e(TAG, "Error while processing received message. Msg: " + throwable.message)
val stack = throwable.stackTrace
for (e in stack) {
Log.e(TAG, String.format("%s#%s:%d", e.className, e.methodName, e.lineNumber))
}
Crashlytics.log(Log.ERROR, TAG, "ConnectedActivity reporting error. Msg: ${throwable.message}")
}
private fun handleIncomingMessage(message: Any?) {
if (message is JsonRpcResponse<*>) {