TransportFailure

A failure of the exchange itself: the request never completed, or completed with something no HttpResponse can hold. Produced by an HttpTransport and by the URL policy.

Experimental (subclass). Subclassing needs @OptIn(ExperimentalForInheritanceWebToolsApi::class); catching, matching and reading a failure are Stable Core. Every leaf nested here is final and has a public constructor, so a transport or a fake can produce any of them. Match the leaves you care about and keep an else: new leaves may be added in a feature release. Messages are constant text plus non-sensitive fields; the cause, when present, is the producer's decision and may carry what the message never does.

Inheritors

Types

Link copied to clipboard
class BodyTooLarge(val limit: Long, val declared: Long?, cause: Throwable?) : TransportFailure

The response body is larger than the transport's limit.

Link copied to clipboard

No connection to the server could be established.

Link copied to clipboard
class DnsFailed(val host: String, cause: Throwable?) : TransportFailure

The host name could not be resolved.

Link copied to clipboard
class InvalidRequest(val rule: String, cause: Throwable?) : TransportFailure

The request broke a rule before it could be sent.

Link copied to clipboard
class Io(cause: Throwable?) : TransportFailure

An I/O error interrupted the exchange after the connection was made.

Link copied to clipboard

The server's response broke the HTTP protocol, a status outside 100..599 included.

Link copied to clipboard

The outbound-URL policy refused the request or a redirect hop.

Link copied to clipboard

The transport refused to send the request a second time, because it is not safe to repeat.

Link copied to clipboard

The request did not complete within the transport's timeout.

Link copied to clipboard

The TLS handshake failed.

Link copied to clipboard
class TooManyRedirects(val limit: Int, cause: Throwable?) : TransportFailure

The request was redirected more often than the transport allows.

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
open val message: String?