HttpFailure

abstract class HttpFailure : Exception(source)

The root of the stack's failure model: every failure a port or a facade returns inside a Result.

Experimental (subclass). Subclassing needs @OptIn(ExperimentalForInheritanceWebToolsApi::class); catching, matching and reading a failure are Stable Core. Its direct leaves Closed, BudgetExhausted and DecodeFailure are final; TransportFailure and UpstreamFailure are gated groups of their own. Match the groups you care about and keep an else: new leaves may be added in a feature release.

Every message is the type's constant text plus its named non-sensitive fields (a component name, a host name, a library-written rule); it never carries free text a caller passes, a header value or a body. A cause, when present, is stored for diagnostics and is not part of the message. Equality is identity. Failures are not designed for Java serialisation.

Inheritors

Types

Link copied to clipboard
class BudgetExhausted(val wait: Duration, val reason: ExhaustedReason, val window: String?) : HttpFailure

The call budget refused the call.

Link copied to clipboard
class Closed(val component: String) : HttpFailure

A component was used after its close().

Link copied to clipboard

A response body could not be decoded into the requested type.

Properties

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