mirror of
https://github.com/etesync/android
synced 2025-06-01 21:58:47 +00:00
Don't pop up notifications when server is under maintenance.
This commit is contained in:
parent
5e8bb06b03
commit
143092ecf3
@ -18,7 +18,7 @@ class Exceptions {
|
|||||||
|
|
||||||
class BadGatewayException(response: Response, message: String) : HttpException(response, message)
|
class BadGatewayException(response: Response, message: String) : HttpException(response, message)
|
||||||
|
|
||||||
class ServiceUnavailableException : HttpException {
|
class ServiceUnavailableException : IgnorableHttpException {
|
||||||
var retryAfter: Long = 0
|
var retryAfter: Long = 0
|
||||||
|
|
||||||
constructor(message: String) : super(message) {
|
constructor(message: String) : super(message) {
|
||||||
@ -32,6 +32,10 @@ class Exceptions {
|
|||||||
|
|
||||||
class IntegrityException(message: String) : GeneralSecurityException(message)
|
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)
|
open class GenericCryptoException(message: String) : Exception(message)
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ class AddressBooksSyncAdapterService : SyncAdapterService() {
|
|||||||
} catch (e: Exceptions.ServiceUnavailableException) {
|
} catch (e: Exceptions.ServiceUnavailableException) {
|
||||||
syncResult.stats.numIoExceptions++
|
syncResult.stats.numIoExceptions++
|
||||||
syncResult.delayUntil = if (e.retryAfter > 0) e.retryAfter else Constants.DEFAULT_RETRY_DELAY
|
syncResult.delayUntil = if (e.retryAfter > 0) e.retryAfter else Constants.DEFAULT_RETRY_DELAY
|
||||||
|
} catch (e: Exceptions.IgnorableHttpException) {
|
||||||
|
// Ignore
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
if (e is ContactsStorageException || e is SQLiteException) {
|
if (e is ContactsStorageException || e is SQLiteException) {
|
||||||
App.log.log(Level.SEVERE, "Couldn't prepare local address books", e)
|
App.log.log(Level.SEVERE, "Couldn't prepare local address books", e)
|
||||||
|
@ -60,6 +60,8 @@ class CalendarsSyncAdapterService : SyncAdapterService() {
|
|||||||
} catch (e: Exceptions.ServiceUnavailableException) {
|
} catch (e: Exceptions.ServiceUnavailableException) {
|
||||||
syncResult.stats.numIoExceptions++
|
syncResult.stats.numIoExceptions++
|
||||||
syncResult.delayUntil = if (e.retryAfter > 0) e.retryAfter else Constants.DEFAULT_RETRY_DELAY
|
syncResult.delayUntil = if (e.retryAfter > 0) e.retryAfter else Constants.DEFAULT_RETRY_DELAY
|
||||||
|
} catch (e: Exceptions.IgnorableHttpException) {
|
||||||
|
// Ignore
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
if (e is CalendarStorageException || e is SQLiteException) {
|
if (e is CalendarStorageException || e is SQLiteException) {
|
||||||
App.log.log(Level.SEVERE, "Couldn't prepare local calendars", e)
|
App.log.log(Level.SEVERE, "Couldn't prepare local calendars", e)
|
||||||
|
@ -187,6 +187,8 @@ constructor(protected val context: Context, protected val account: Account, prot
|
|||||||
} catch (e: InterruptedException) {
|
} catch (e: InterruptedException) {
|
||||||
// Restart sync if interrupted
|
// Restart sync if interrupted
|
||||||
syncResult.fullSyncRequested = true
|
syncResult.fullSyncRequested = true
|
||||||
|
} catch (e: Exceptions.IgnorableHttpException) {
|
||||||
|
// Ignore
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
if (e is Exceptions.UnauthorizedException) {
|
if (e is Exceptions.UnauthorizedException) {
|
||||||
syncResult.stats.numAuthExceptions++
|
syncResult.stats.numAuthExceptions++
|
||||||
|
@ -77,6 +77,8 @@ class TasksSyncAdapterService: SyncAdapterService() {
|
|||||||
} catch (e: Exceptions.ServiceUnavailableException) {
|
} catch (e: Exceptions.ServiceUnavailableException) {
|
||||||
syncResult.stats.numIoExceptions++
|
syncResult.stats.numIoExceptions++
|
||||||
syncResult.delayUntil = if (e.retryAfter > 0) e.retryAfter else Constants.DEFAULT_RETRY_DELAY
|
syncResult.delayUntil = if (e.retryAfter > 0) e.retryAfter else Constants.DEFAULT_RETRY_DELAY
|
||||||
|
} catch (e: Exceptions.IgnorableHttpException) {
|
||||||
|
// Ignore
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
if (e is SQLiteException) {
|
if (e is SQLiteException) {
|
||||||
App.log.log(Level.SEVERE, "Couldn't prepare local task list", e)
|
App.log.log(Level.SEVERE, "Couldn't prepare local task list", e)
|
||||||
|
Loading…
Reference in New Issue
Block a user