feat: Show a specific message if requests are rate-limited (#818)
This commit is contained in:
parent
af11e3d3a1
commit
b878211891
|
@ -105,6 +105,7 @@ sealed class ClientError(
|
||||||
401 -> Unauthorized(exception)
|
401 -> Unauthorized(exception)
|
||||||
404 -> NotFound(exception)
|
404 -> NotFound(exception)
|
||||||
410 -> Gone(exception)
|
410 -> Gone(exception)
|
||||||
|
429 -> RateLimit(exception)
|
||||||
else -> UnknownClientError(exception)
|
else -> UnknownClientError(exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,6 +127,10 @@ sealed class ClientError(
|
||||||
data class Gone(override val exception: HttpException) :
|
data class Gone(override val exception: HttpException) :
|
||||||
ClientError(R.string.error_generic_fmt, exception)
|
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 */
|
/** All other 4xx client errors */
|
||||||
data class UnknownClientError(override val exception: HttpException) :
|
data class UnknownClientError(override val exception: HttpException) :
|
||||||
ClientError(R.string.error_generic_fmt, exception)
|
ClientError(R.string.error_generic_fmt, exception)
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<string name="server_error_unparseable_version">could not parse \"%1$s\" as a version: %2$s</string>
|
<string name="server_error_unparseable_version">could not parse \"%1$s\" as a version: %2$s</string>
|
||||||
<string name="error_generic_fmt">An error occurred: %s</string>
|
<string name="error_generic_fmt">An error occurred: %s</string>
|
||||||
<string name="error_404_not_found_fmt">Your server does not support this feature: %1$s</string>
|
<string name="error_404_not_found_fmt">Your server does not support this feature: %1$s</string>
|
||||||
|
<string name="error_429_rate_limit_fmt">your server is rate-limiting your requests: %1$s</string>
|
||||||
<string name="error_json_data_fmt">Your server returned an invalid response: %1$s</string>
|
<string name="error_json_data_fmt">Your server returned an invalid response: %1$s</string>
|
||||||
<string name="error_network_fmt">A network error occurred: %s</string>
|
<string name="error_network_fmt">A network error occurred: %s</string>
|
||||||
<string name="error_missing_content_type_fmt">your server is mis-configured, the response has no content-type: %1$s</string>
|
<string name="error_missing_content_type_fmt">your server is mis-configured, the response has no content-type: %1$s</string>
|
||||||
|
|
Loading…
Reference in New Issue