1
0
mirror of https://github.com/etesync/android synced 2024-11-22 16:08:13 +00:00

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.
This commit is contained in:
Tom Hacohen 2019-06-12 13:18:09 +01:00
parent fb2ed34379
commit 1a7ef1b78e
4 changed files with 13 additions and 4 deletions

View File

@ -78,7 +78,7 @@ constructor(context: Context, account: Account, settings: AccountSettings, extra
} }
@Throws(IOException::class, ContactsStorageException::class, CalendarStorageException::class, InvalidCalendarException::class) @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 inputReader = StringReader(cEntry.content)
val events = Event.fromReader(inputReader) val events = Event.fromReader(inputReader)

View File

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

View File

@ -288,7 +288,16 @@ constructor(protected val context: Context, protected val account: Account, prot
} }
@Throws(IOException::class, ContactsStorageException::class, CalendarStorageException::class, InvalidCalendarException::class) @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) { private fun persistSyncEntry(uid: String?, syncEntry: SyncEntry) {
val entry = EntryEntity() val entry = EntryEntity()

View File

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