1
0
mirror of https://github.com/etesync/android synced 2025-01-11 00:01:12 +00:00

Gracefully handle trying to insert again an entry we have in the db.

This commit is contained in:
Tom Hacohen 2019-10-09 13:20:44 +03:00
parent 70da2ed6d7
commit 5df3a59a2e

View File

@ -303,7 +303,15 @@ constructor(protected val context: Context, protected val account: Account, prot
entry.uid = uid
entry.content = syncEntry
entry.journal = journalEntity
data.insert(entry)
try {
data.insert(entry)
} catch (e: io.requery.sql.StatementExecutionException) {
if (e.cause is java.sql.SQLIntegrityConstraintViolationException) {
Logger.log.warning("Tried inserting an existing entry ${uid}")
} else {
throw e
}
}
}
@Throws(IOException::class, ContactsStorageException::class, CalendarStorageException::class, Exceptions.HttpException::class, InvalidCalendarException::class, InterruptedException::class)