Network

sealed interface Network : CgsError

Errors caused by network conditions or HTTP responses.

Typical use cases:

  • User is offline

  • Server returned an error response

  • Request timed out or was rate limited

Inheritors

Types

Link copied to clipboard
data class Http(val code: Int, val body: String? = null) : CgsError.Network

The request failed with a non-successful HTTP status code. 401, 403 and 429 come back as Auth.Unauthorized, Auth.Forbidden and RateLimited instead.

Link copied to clipboard

The request failed on the way: no connection, an unreachable server or a dropped connection — any I/O failure other than a timeout.

Link copied to clipboard
data class RateLimited(val retryAfterSec: Long?) : CgsError.Network

The server rate-limited the request.

Link copied to clipboard

The request timed out before receiving a response.