@@ -2,6 +2,7 @@ package com.x8bit.bitwarden.data.vault.datasource.disk
2
2
3
3
import com.x8bit.bitwarden.data.platform.manager.dispatcher.DispatcherManager
4
4
import com.x8bit.bitwarden.data.platform.repository.util.bufferedMutableSharedFlow
5
+ import com.x8bit.bitwarden.data.platform.util.decodeFromStringWithErrorCallback
5
6
import com.x8bit.bitwarden.data.vault.datasource.disk.dao.CiphersDao
6
7
import com.x8bit.bitwarden.data.vault.datasource.disk.dao.CollectionsDao
7
8
import com.x8bit.bitwarden.data.vault.datasource.disk.dao.DomainsDao
@@ -24,6 +25,7 @@ import kotlinx.coroutines.launch
24
25
import kotlinx.coroutines.withContext
25
26
import kotlinx.serialization.encodeToString
26
27
import kotlinx.serialization.json.Json
28
+ import timber.log.Timber
27
29
28
30
/* *
29
31
* Default implementation of [VaultDiskSource].
@@ -70,9 +72,9 @@ class VaultDiskSourceImpl(
70
72
entities
71
73
.map { entity ->
72
74
async {
73
- json.decodeFromString <SyncResponseJson .Cipher >(
75
+ json.decodeFromStringWithErrorCallback <SyncResponseJson .Cipher >(
74
76
string = entity.cipherJson,
75
- )
77
+ ) { Timber .e(it, " Failed to deserialize Cipher in Vault " ) }
76
78
}
77
79
}
78
80
.awaitAll()
@@ -126,7 +128,11 @@ class VaultDiskSourceImpl(
126
128
.getDomains(userId)
127
129
.map { entity ->
128
130
withContext(dispatcherManager.default) {
129
- entity?.domainsJson?.let { json.decodeFromString<SyncResponseJson .Domains >(it) }
131
+ entity?.domainsJson?.let { domains ->
132
+ json.decodeFromStringWithErrorCallback<SyncResponseJson .Domains >(
133
+ string = domains,
134
+ ) { Timber .e(it, " Failed to deserialize Domains in Vault" ) }
135
+ }
130
136
}
131
137
}
132
138
@@ -192,7 +198,9 @@ class VaultDiskSourceImpl(
192
198
entities
193
199
.map { entity ->
194
200
async {
195
- json.decodeFromString<SyncResponseJson .Send >(entity.sendJson)
201
+ json.decodeFromStringWithErrorCallback<SyncResponseJson .Send >(
202
+ string = entity.sendJson,
203
+ ) { Timber .e(it, " Failed to deserialize Send in Vault" ) }
196
204
}
197
205
}
198
206
.awaitAll()
0 commit comments