1
0
mirror of https://github.com/etesync/android synced 2025-01-22 13:40:55 +00:00

Don't pop up notifications when server is under maintenance.

This commit is contained in:
Tom Hacohen 2019-02-13 18:41:21 +00:00
parent 5e8bb06b03
commit 143092ecf3
5 changed files with 13 additions and 1 deletions

View File

@ -18,7 +18,7 @@ class Exceptions {
class BadGatewayException(response: Response, message: String) : HttpException(response, message)
class ServiceUnavailableException : HttpException {
class ServiceUnavailableException : IgnorableHttpException {
var retryAfter: Long = 0
constructor(message: String) : super(message) {
@ -32,6 +32,10 @@ class Exceptions {
class IntegrityException(message: String) : GeneralSecurityException(message)
open class IgnorableHttpException : HttpException {
constructor(message: String) : super(message)
constructor(response: Response, message: String) : super(response, message)
}
open class GenericCryptoException(message: String) : Exception(message)

View File

@ -72,6 +72,8 @@ class AddressBooksSyncAdapterService : SyncAdapterService() {
} 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) {
if (e is ContactsStorageException || e is SQLiteException) {
App.log.log(Level.SEVERE, "Couldn't prepare local address books", e)

View File

@ -60,6 +60,8 @@ class CalendarsSyncAdapterService : SyncAdapterService() {
} 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) {
if (e is CalendarStorageException || e is SQLiteException) {
App.log.log(Level.SEVERE, "Couldn't prepare local calendars", e)

View File

@ -187,6 +187,8 @@ constructor(protected val context: Context, protected val account: Account, prot
} catch (e: InterruptedException) {
// Restart sync if interrupted
syncResult.fullSyncRequested = true
} catch (e: Exceptions.IgnorableHttpException) {
// Ignore
} catch (e: Exception) {
if (e is Exceptions.UnauthorizedException) {
syncResult.stats.numAuthExceptions++

View File

@ -77,6 +77,8 @@ class TasksSyncAdapterService: SyncAdapterService() {
} 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) {
if (e is SQLiteException) {
App.log.log(Level.SEVERE, "Couldn't prepare local task list", e)