1
0
mirror of https://github.com/etesync/android synced 2025-01-23 14:10:54 +00:00

Handle readonly journal exceptions.

This commit is contained in:
Tom Hacohen 2019-01-11 16:12:53 +00:00
parent dcd0393a31
commit 92908b9a60
4 changed files with 9 additions and 2 deletions

View File

@ -44,6 +44,9 @@ class NotificationHelper(internal val context: Context, internal val notificatio
} else if (e is Exceptions.ServiceUnavailableException) {
App.log.log(Level.SEVERE, "Service unavailable")
messageString = R.string.sync_error_unavailable
} else if (e is Exceptions.ReadOnlyException) {
App.log.log(Level.SEVERE, "Journal is read only", e)
messageString = R.string.sync_error_journal_readonly
} else if (e is Exceptions.HttpException) {
App.log.log(Level.SEVERE, "HTTP Exception during sync", e)
messageString = R.string.sync_error_http_dav

View File

@ -34,8 +34,9 @@ abstract class BaseManager {
throw Exceptions.UserInactiveException(response, apiError.detail)
} else if (apiError.code == "associate_not_allowed") {
throw Exceptions.AssociateNotAllowedException(response, apiError.detail)
}
}
} else if (apiError.code == "journal_owner_inactive") {
throw Exceptions.ReadOnlyException(response, apiError.detail)
} }
}// Fall through. We want to always throw when unsuccessful.
throw Exceptions.HttpException(response, apiError.detail)

View File

@ -10,6 +10,8 @@ import java.security.GeneralSecurityException
class Exceptions {
class AssociateNotAllowedException(response: Response, message: String?) : HttpException(response, message)
class ReadOnlyException(response: Response, message: String?) : HttpException(response, message)
class UnauthorizedException(response: Response, message: String?) : HttpException(response, message)
class UserInactiveException(response: Response, message: String?) : HttpException(response, message)

View File

@ -315,6 +315,7 @@
<string name="sync_error_http_dav">Server error while %s</string>
<string name="sync_error_unavailable">Could not connect to server while %s</string>
<string name="sync_error_local_storage">Database error while %s</string>
<string name="sync_error_journal_readonly">Journal is read only</string>
<string name="sync_phase_prepare">preparing synchronization</string>
<string name="sync_phase_journals">syncronizing journals</string>
<string name="sync_phase_query_capabilities">querying capabilities</string>