1
0
mirror of https://github.com/etesync/android synced 2024-11-22 07:58:09 +00:00

Add a separate exception for HttpConflict.

This commit is contained in:
Tom Hacohen 2019-05-01 09:10:21 +01:00
parent fe980f937e
commit 1d5bcc6a3d
2 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,7 @@ abstract class BaseManager {
HttpURLConnection.HTTP_BAD_GATEWAY -> throw Exceptions.BadGatewayException(response, "Bad gateway: most likely a server restart") 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_UNAVAILABLE -> throw Exceptions.ServiceUnavailableException(response, "Service unavailable")
HttpURLConnection.HTTP_UNAUTHORIZED -> throw Exceptions.UnauthorizedException(response, "Unauthorized auth token") HttpURLConnection.HTTP_UNAUTHORIZED -> throw Exceptions.UnauthorizedException(response, "Unauthorized auth token")
HttpURLConnection.HTTP_CONFLICT -> throw Exceptions.ConflictException(response, "Http conflict")
HttpURLConnection.HTTP_FORBIDDEN -> { HttpURLConnection.HTTP_FORBIDDEN -> {
if (apiError.code == "service_inactive") { if (apiError.code == "service_inactive") {
throw Exceptions.UserInactiveException(response, apiError.detail) throw Exceptions.UserInactiveException(response, apiError.detail)

View File

@ -10,6 +10,8 @@ import java.security.GeneralSecurityException
class Exceptions { class Exceptions {
class AssociateNotAllowedException(response: Response, message: String?) : HttpException(response, message) 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 ReadOnlyException(response: Response, message: String?) : HttpException(response, message)
class UnauthorizedException(response: Response, message: String?) : HttpException(response, message) class UnauthorizedException(response: Response, message: String?) : HttpException(response, message)