1
0
mirror of https://github.com/etesync/android synced 2024-12-24 07:28:09 +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.log.Logger
import com.etesync.syncadapter.model.* import com.etesync.syncadapter.model.*
import com.etesync.syncadapter.model.SyncEntry.Actions.ADD import com.etesync.syncadapter.model.SyncEntry.Actions.ADD
import com.etesync.syncadapter.resource.LocalCollection import com.etesync.syncadapter.resource.*
import com.etesync.syncadapter.resource.LocalResource
import com.etesync.syncadapter.ui.AccountsActivity import com.etesync.syncadapter.ui.AccountsActivity
import com.etesync.syncadapter.ui.DebugInfoActivity import com.etesync.syncadapter.ui.DebugInfoActivity
import com.etesync.syncadapter.ui.ViewCollectionActivity import com.etesync.syncadapter.ui.ViewCollectionActivity
@ -456,14 +455,26 @@ constructor(protected val context: Context, protected val account: Account, prot
action = SyncEntry.Actions.CHANGE action = SyncEntry.Actions.CHANGE
} }
val entry = SyncEntry(local.content, action) try {
val tmp = JournalEntryManager.Entry() val entry = SyncEntry(local.content, action)
tmp.update(crypto, entry.toJson(), previousEntry) val tmp = JournalEntryManager.Entry()
previousEntry = tmp tmp.update(crypto, entry.toJson(), previousEntry)
localEntries!!.add(previousEntry) previousEntry = tmp
localEntries!!.add(previousEntry)
if (localEntries!!.size == MAX_PUSH) { if (localEntries!!.size == MAX_PUSH) {
return 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
} }
} }
} }