Skip to content

fix(client): catch possible thrown exceptions from BalanceController#fetchBalanceSuspend #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions api/src/main/java/com/getcode/network/client/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.getcode.network.repository.TransactionRepository
import com.getcode.utils.network.NetworkConnectivityListener
import com.getcode.network.service.ChatService
import com.getcode.network.service.DeviceService
import com.getcode.utils.ErrorUtils
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -85,10 +86,13 @@ class Client @Inject constructor(

private suspend fun poll() {
if (networkObserver.isConnected) {
balanceController.fetchBalanceSuspend()
exchange.fetchRatesIfNeeded()
fetchLimits()
fetchPrivacyUpgrades()
try {
balanceController.fetchBalanceSuspend()
exchange.fetchRatesIfNeeded()
} catch (e: Exception) {
ErrorUtils.handleError(e)
}
fetchLimits().andThen(fetchPrivacyUpgrades()).blockingSubscribe()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ object DeviceCheck: CoroutineScope by CoroutineScope(Dispatchers.IO) {
onIdentifier(Result.success(it.visitorId)) },
errorListener = {
val error = Throwable("Device Check failed:: ${it.description}")
ErrorUtils.handleError(error)
// ErrorUtils.handleError(error)
// onIdentifier(Result.failure(error))
onIdentifier(Result.success(null))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ class IdentityRepository @Inject constructor(

IdentityService.GetTwitterUserResponse.Result.NOT_FOUND -> {
val error = TwitterUserFetchError.NotFound()
ErrorUtils.handleError(error)
Result.failure(error)
}

Expand Down
Loading