1
0
mirror of https://github.com/etesync/android synced 2024-12-23 15:18:14 +00:00

Improve debug information in createLocalEntry.

Print some extra information about the entry we failed to create.
This commit is contained in:
Tom Hacohen 2019-09-25 23:55:18 +03:00
parent 4abf351d9e
commit b50c633ca1

View File

@ -24,8 +24,7 @@ import com.etesync.syncadapter.journalmanager.JournalEntryManager
import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.model.*
import com.etesync.syncadapter.model.SyncEntry.Actions.ADD
import com.etesync.syncadapter.resource.LocalCollection
import com.etesync.syncadapter.resource.LocalResource
import com.etesync.syncadapter.resource.*
import com.etesync.syncadapter.ui.AccountsActivity
import com.etesync.syncadapter.ui.DebugInfoActivity
import com.etesync.syncadapter.ui.ViewCollectionActivity
@ -456,6 +455,7 @@ constructor(protected val context: Context, protected val account: Account, prot
action = SyncEntry.Actions.CHANGE
}
try {
val entry = SyncEntry(local.content, action)
val tmp = JournalEntryManager.Entry()
tmp.update(crypto, entry.toJson(), previousEntry)
@ -465,6 +465,17 @@ constructor(protected val context: Context, protected val account: Account, prot
if (localEntries!!.size == MAX_PUSH) {
return
}
} catch (e: Exception) {
Logger.log.warning("Failed creating local entry ${local.uuid}")
if (local is LocalContact) {
Logger.log.warning("Contact with title ${local.contact?.displayName}")
} else if (local is LocalEvent) {
Logger.log.warning("Event with title ${local.event?.summary}")
} else if (local is LocalTask) {
Logger.log.warning("Task with title ${local.task?.summary}")
}
throw e
}
}
}