Sync: log broken entries on processing failure.

This change prints the content of broken entries (ones that fail parsing)
to the log so it's easier to debug issues.
pull/96/head
Tom Hacohen 5 years ago
parent fb2ed34379
commit 1a7ef1b78e

@ -78,7 +78,7 @@ constructor(context: Context, account: Account, settings: AccountSettings, extra
}
@Throws(IOException::class, ContactsStorageException::class, CalendarStorageException::class, InvalidCalendarException::class)
override fun processSyncEntry(cEntry: SyncEntry) {
override fun processSyncEntryImpl(cEntry: SyncEntry) {
val inputReader = StringReader(cEntry.content)
val events = Event.fromReader(inputReader)

@ -127,7 +127,7 @@ constructor(context: Context, account: Account, settings: AccountSettings, extra
}
@Throws(IOException::class, ContactsStorageException::class, CalendarStorageException::class)
override fun processSyncEntry(cEntry: SyncEntry) {
override fun processSyncEntryImpl(cEntry: SyncEntry) {
val inputReader = StringReader(cEntry.content)
val contacts = Contact.fromReader(inputReader, resourceDownloader)

@ -288,7 +288,16 @@ constructor(protected val context: Context, protected val account: Account, prot
}
@Throws(IOException::class, ContactsStorageException::class, CalendarStorageException::class, InvalidCalendarException::class)
protected abstract fun processSyncEntry(cEntry: SyncEntry)
protected abstract fun processSyncEntryImpl(cEntry: SyncEntry)
protected fun processSyncEntry(cEntry: SyncEntry) {
try {
processSyncEntryImpl(cEntry)
} catch (e: Exception) {
Logger.log.warning("Failed processing entry: ${cEntry.content}")
throw e
}
}
private fun persistSyncEntry(uid: String?, syncEntry: SyncEntry) {
val entry = EntryEntity()

@ -68,7 +68,7 @@ class TasksSyncManager(
return localCollection as LocalTaskList
}
override fun processSyncEntry(cEntry: SyncEntry) {
override fun processSyncEntryImpl(cEntry: SyncEntry) {
val inputReader = StringReader(cEntry.content)
val tasks = Task.fromReader(inputReader)

Loading…
Cancel
Save