From 6250cacd301d3f700738defdb194dcf10ccb8405 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 1 May 2019 09:15:14 +0100 Subject: [PATCH] Add missing exception handling to contacts sync. It wasn't handling IgnorableException. --- .../syncadapter/syncadapter/ContactsSyncAdapterService.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/etesync/syncadapter/syncadapter/ContactsSyncAdapterService.kt b/app/src/main/java/com/etesync/syncadapter/syncadapter/ContactsSyncAdapterService.kt index c562ffe4..781442c6 100644 --- a/app/src/main/java/com/etesync/syncadapter/syncadapter/ContactsSyncAdapterService.kt +++ b/app/src/main/java/com/etesync/syncadapter/syncadapter/ContactsSyncAdapterService.kt @@ -62,6 +62,11 @@ class ContactsSyncAdapterService : SyncAdapterService() { ContactsSyncManager(context, account, settings, extras, authority, provider, syncResult, addressBook, principal).use { it.performSync() } + } catch (e: Exceptions.ServiceUnavailableException) { + syncResult.stats.numIoExceptions++ + syncResult.delayUntil = if (e.retryAfter > 0) e.retryAfter else Constants.DEFAULT_RETRY_DELAY + } catch (e: Exceptions.IgnorableHttpException) { + // Ignore } catch (e: Exception) { val syncPhase = R.string.sync_phase_journals val title = context.getString(R.string.sync_error_contacts, account.name)