UpstreamFailure

A complete answer from the server that the caller must treat as a failure: the exchange succeeded, the status did not. Produced by the call facades.

Experimental (subclass). Subclassing needs @OptIn(ExperimentalForInheritanceWebToolsApi::class); catching, matching and reading a failure are Stable Core. The leaves RateLimited and UpstreamError are final. Match the leaves you care about and keep an else: new leaves may be added in a feature release.

Parameters

status

the response status, in 100..599.

message

the constant text of the type plus its non-sensitive fields.

Throws

if status is outside 100..599.

Inheritors

Types

Link copied to clipboard

The server throttled the call.

Link copied to clipboard
class UpstreamError(status: Int, val headers: HttpHeaders, body: ByteArray) : UpstreamFailure

The server answered with a status the caller must handle. It keeps the response headers and body, copied in and read back as copies, and prints neither: message and toString() carry the status only.

Properties

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

The response status, in 100..599.