Skip to content

Commit 2a51d14

Browse files
authored
Merge pull request #382 from code-payments/fix/catch-balance-suspend-failures
Fix/catch balance suspend failures
2 parents 3b82a39 + fbfee71 commit 2a51d14

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

api/src/main/java/com/getcode/network/client/Client.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import com.getcode.network.repository.TransactionRepository
1414
import com.getcode.utils.network.NetworkConnectivityListener
1515
import com.getcode.network.service.ChatService
1616
import com.getcode.network.service.DeviceService
17+
import com.getcode.utils.ErrorUtils
1718
import dagger.hilt.android.qualifiers.ApplicationContext
1819
import kotlinx.coroutines.CoroutineScope
1920
import kotlinx.coroutines.Dispatchers
@@ -85,10 +86,13 @@ class Client @Inject constructor(
8586

8687
private suspend fun poll() {
8788
if (networkObserver.isConnected) {
88-
balanceController.fetchBalanceSuspend()
89-
exchange.fetchRatesIfNeeded()
90-
fetchLimits()
91-
fetchPrivacyUpgrades()
89+
try {
90+
balanceController.fetchBalanceSuspend()
91+
exchange.fetchRatesIfNeeded()
92+
} catch (e: Exception) {
93+
ErrorUtils.handleError(e)
94+
}
95+
fetchLimits().andThen(fetchPrivacyUpgrades()).blockingSubscribe()
9296
}
9397
}
9498

api/src/main/java/com/getcode/network/integrity/DeviceCheck.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ object DeviceCheck: CoroutineScope by CoroutineScope(Dispatchers.IO) {
114114
onIdentifier(Result.success(it.visitorId)) },
115115
errorListener = {
116116
val error = Throwable("Device Check failed:: ${it.description}")
117-
ErrorUtils.handleError(error)
117+
// ErrorUtils.handleError(error)
118118
// onIdentifier(Result.failure(error))
119119
onIdentifier(Result.success(null))
120120
}

api/src/main/java/com/getcode/network/repository/IdentityRepository.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ class IdentityRepository @Inject constructor(
371371

372372
IdentityService.GetTwitterUserResponse.Result.NOT_FOUND -> {
373373
val error = TwitterUserFetchError.NotFound()
374-
ErrorUtils.handleError(error)
375374
Result.failure(error)
376375
}
377376

0 commit comments

Comments
 (0)