diff --git a/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncAdapterService.kt b/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncAdapterService.kt index ecc1bd6e..897b3171 100644 --- a/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncAdapterService.kt +++ b/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncAdapterService.kt @@ -23,6 +23,9 @@ import androidx.core.util.Pair import at.bitfire.ical4android.CalendarStorageException import at.bitfire.vcard4android.ContactsStorageException import com.etebase.client.FetchOptions +import com.etebase.client.exceptions.ConnectionException +import com.etebase.client.exceptions.TemporaryServerErrorException +import com.etebase.client.exceptions.UnauthorizedException import com.etesync.syncadapter.* import com.etesync.journalmanager.Crypto import com.etesync.journalmanager.Exceptions @@ -118,6 +121,12 @@ abstract class SyncAdapterService : Service() { } catch (e: Exceptions.ServiceUnavailableException) { syncResult.stats.numIoExceptions++ syncResult.delayUntil = if (e.retryAfter > 0) e.retryAfter else Constants.DEFAULT_RETRY_DELAY + } catch (e: TemporaryServerErrorException) { + syncResult.stats.numIoExceptions++ + syncResult.delayUntil = Constants.DEFAULT_RETRY_DELAY + } catch (e: ConnectionException) { + syncResult.stats.numIoExceptions++ + syncResult.delayUntil = Constants.DEFAULT_RETRY_DELAY } catch (e: Exceptions.IgnorableHttpException) { // Ignore } catch (e: Exception) { @@ -133,7 +142,7 @@ abstract class SyncAdapterService : Service() { val detailsIntent = notificationManager.detailsIntent detailsIntent.putExtra(Constants.KEY_ACCOUNT, account) - if (e !is Exceptions.UnauthorizedException) { + if (e !is Exceptions.UnauthorizedException && e !is UnauthorizedException) { detailsIntent.putExtra(DebugInfoActivity.KEY_AUTHORITY, authority) detailsIntent.putExtra(DebugInfoActivity.KEY_PHASE, syncPhase) } diff --git a/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.kt b/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.kt index ebb9b9bf..1c4a3bc1 100644 --- a/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.kt +++ b/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.kt @@ -17,6 +17,10 @@ import at.bitfire.ical4android.CalendarStorageException import at.bitfire.ical4android.InvalidCalendarException import at.bitfire.vcard4android.ContactsStorageException import com.etebase.client.* +import com.etebase.client.exceptions.ConnectionException +import com.etebase.client.exceptions.HttpException +import com.etebase.client.exceptions.TemporaryServerErrorException +import com.etebase.client.exceptions.UnauthorizedException import com.etesync.syncadapter.* import com.etesync.syncadapter.Constants.KEY_ACCOUNT import com.etesync.journalmanager.Crypto @@ -275,15 +279,21 @@ constructor(protected val context: Context, protected val account: Account, prot } catch (e: Exceptions.ServiceUnavailableException) { syncResult.stats.numIoExceptions++ syncResult.delayUntil = if (e.retryAfter > 0) e.retryAfter else Constants.DEFAULT_RETRY_DELAY + } catch (e: TemporaryServerErrorException) { + syncResult.stats.numIoExceptions++ + syncResult.delayUntil = Constants.DEFAULT_RETRY_DELAY + } catch (e: ConnectionException) { + syncResult.stats.numIoExceptions++ + syncResult.delayUntil = Constants.DEFAULT_RETRY_DELAY } catch (e: InterruptedException) { // Restart sync if interrupted syncResult.fullSyncRequested = true } catch (e: Exceptions.IgnorableHttpException) { // Ignore } catch (e: Exception) { - if (e is Exceptions.UnauthorizedException) { + if (e is Exceptions.UnauthorizedException || e is UnauthorizedException) { syncResult.stats.numAuthExceptions++ - } else if (e is Exceptions.HttpException) { + } else if (e is Exceptions.HttpException || e is HttpException) { syncResult.stats.numParseExceptions++ } else if (e is CalendarStorageException || e is ContactsStorageException) { syncResult.databaseError = true