From 1d5bcc6a3dd0dfcf4aad4b16139ff048272c0651 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 1 May 2019 09:10:21 +0100 Subject: [PATCH] Add a separate exception for HttpConflict. --- .../java/com/etesync/syncadapter/journalmanager/BaseManager.kt | 1 + .../java/com/etesync/syncadapter/journalmanager/Exceptions.kt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/src/main/java/com/etesync/syncadapter/journalmanager/BaseManager.kt b/app/src/main/java/com/etesync/syncadapter/journalmanager/BaseManager.kt index bfb32cd8..5e29f684 100644 --- a/app/src/main/java/com/etesync/syncadapter/journalmanager/BaseManager.kt +++ b/app/src/main/java/com/etesync/syncadapter/journalmanager/BaseManager.kt @@ -34,6 +34,7 @@ abstract class BaseManager { HttpURLConnection.HTTP_BAD_GATEWAY -> throw Exceptions.BadGatewayException(response, "Bad gateway: most likely a server restart") HttpURLConnection.HTTP_UNAVAILABLE -> throw Exceptions.ServiceUnavailableException(response, "Service unavailable") HttpURLConnection.HTTP_UNAUTHORIZED -> throw Exceptions.UnauthorizedException(response, "Unauthorized auth token") + HttpURLConnection.HTTP_CONFLICT -> throw Exceptions.ConflictException(response, "Http conflict") HttpURLConnection.HTTP_FORBIDDEN -> { if (apiError.code == "service_inactive") { throw Exceptions.UserInactiveException(response, apiError.detail) diff --git a/app/src/main/java/com/etesync/syncadapter/journalmanager/Exceptions.kt b/app/src/main/java/com/etesync/syncadapter/journalmanager/Exceptions.kt index fecebf6f..c4901251 100644 --- a/app/src/main/java/com/etesync/syncadapter/journalmanager/Exceptions.kt +++ b/app/src/main/java/com/etesync/syncadapter/journalmanager/Exceptions.kt @@ -10,6 +10,8 @@ import java.security.GeneralSecurityException class Exceptions { class AssociateNotAllowedException(response: Response, message: String?) : HttpException(response, message) + class ConflictException(response: Response, message: String?) : IgnorableHttpException(response, message ?: "Conflict exception") + class ReadOnlyException(response: Response, message: String?) : HttpException(response, message) class UnauthorizedException(response: Response, message: String?) : HttpException(response, message)