1
0
mirror of https://github.com/etesync/android synced 2024-12-23 15:18:14 +00:00

Add an exception for a bad gateway error.

This commit is contained in:
Tom Hacohen 2019-02-13 18:40:32 +00:00
parent 79ddd1d7c9
commit 5e8bb06b03
2 changed files with 3 additions and 0 deletions

View File

@ -27,6 +27,7 @@ abstract class BaseManager {
val apiError = GsonHelper.gson.fromJson(response.body()!!.charStream(), ApiError::class.java)
when (response.code()) {
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_FORBIDDEN -> {

View File

@ -16,6 +16,8 @@ class Exceptions {
class UserInactiveException(response: Response, message: String?) : HttpException(response, message)
class BadGatewayException(response: Response, message: String) : HttpException(response, message)
class ServiceUnavailableException : HttpException {
var retryAfter: Long = 0