@@ -339,17 +339,22 @@ class MainViewModel @Inject constructor(
339
339
}
340
340
341
341
private suspend fun updateMyKSuiteData () {
342
- MyKSuiteDataUtils .requestKSuiteData()
343
- val apiResponse = ApiRepository .getMyKSuiteData(HttpClient .okHttpClient)
344
- if (apiResponse.data != null ) {
345
- MyKSuiteDataUtils .upsertKSuiteData(apiResponse.data!! )
346
- } else {
347
- @OptIn(ExperimentalSerializationApi ::class )
348
- apiResponse.error?.exception?.let {
349
- if (it is MissingFieldException || it.message?.contains(" Unexpected JSON token" ) == true ) {
350
- SentryLog .e(TAG , " Error decoding the api result MyKSuiteObject" , it)
342
+ runCatching {
343
+ MyKSuiteDataUtils .requestKSuiteData()
344
+ val apiResponse = ApiRepository .getMyKSuiteData(HttpClient .okHttpClient)
345
+ if (apiResponse.data != null ) {
346
+ MyKSuiteDataUtils .upsertKSuiteData(apiResponse.data!! )
347
+ } else {
348
+ @OptIn(ExperimentalSerializationApi ::class )
349
+ apiResponse.error?.exception?.let {
350
+ if (it is MissingFieldException || it.message?.contains(" Unexpected JSON token" ) == true ) {
351
+ SentryLog .e(TAG , " Error decoding the api result MyKSuiteObject" , it)
352
+ }
351
353
}
352
354
}
355
+ }.onFailure { exception ->
356
+ if (exception is CancellationException ) throw exception
357
+ SentryLog .d(TAG , " Exception during myKSuite data fetch" , exception)
353
358
}
354
359
}
355
360
0 commit comments