diff --git a/core/network/src/main/kotlin/app/pachli/core/network/retrofit/apiresult/ApiResult.kt b/core/network/src/main/kotlin/app/pachli/core/network/retrofit/apiresult/ApiResult.kt index ebc227423..850f455cc 100644 --- a/core/network/src/main/kotlin/app/pachli/core/network/retrofit/apiresult/ApiResult.kt +++ b/core/network/src/main/kotlin/app/pachli/core/network/retrofit/apiresult/ApiResult.kt @@ -105,6 +105,7 @@ sealed class ClientError( 401 -> Unauthorized(exception) 404 -> NotFound(exception) 410 -> Gone(exception) + 429 -> RateLimit(exception) else -> UnknownClientError(exception) } } @@ -126,6 +127,10 @@ sealed class ClientError( data class Gone(override val exception: HttpException) : ClientError(R.string.error_generic_fmt, exception) + /** 429 Rate limit */ + data class RateLimit(override val exception: HttpException) : + ClientError(R.string.error_429_rate_limit_fmt, exception) + /** All other 4xx client errors */ data class UnknownClientError(override val exception: HttpException) : ClientError(R.string.error_generic_fmt, exception) diff --git a/core/network/src/main/res/values/strings.xml b/core/network/src/main/res/values/strings.xml index 49e9e8640..6ecb876d1 100644 --- a/core/network/src/main/res/values/strings.xml +++ b/core/network/src/main/res/values/strings.xml @@ -23,6 +23,7 @@ could not parse \"%1$s\" as a version: %2$s An error occurred: %s Your server does not support this feature: %1$s + your server is rate-limiting your requests: %1$s Your server returned an invalid response: %1$s A network error occurred: %s your server is mis-configured, the response has no content-type: %1$s