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:
parent
79ddd1d7c9
commit
5e8bb06b03
@ -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 -> {
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user