HTTP.RequestError (http_fetch v0.21.18)

Copy Markdown View Source

Opt-in failure evidence returned with error_mode: :structured.

reason retains the original error. phase: :connect and request_started: false prove that the TCP connection failed before it was established, for direct TCP and OTP TLS routes using redirect: :manual or :error. Automatic redirect chains always give conservative evidence. phase: :tls_setup confirms a fatal handshake or certificate alert after accepted ServerHello and before HTTP transmission on a direct, unpooled HTTP/1 TLS route. It requires the ordinary handshake (no custom handshake or early_data option). OTP tracks both TLS processes before continuation; ExSSL supplies authenticated public evidence from the original attempt. Await cleanup separately before trying another validated pin.

All other failures report phase: :unknown and request_started: :unknown, including earlier TLS failures, pooled connections, cancellation, source/send/response errors, and deadlines whose connection state cannot be confirmed or whose provider phase evidence is unavailable.

pre_send?/1 identifies the only evidence suitable for caller-managed validated-address failover. Fetch never retries an attempt automatically. The caller must preserve its original absolute deadline and cancellation signal across attempts, and validate every address before providing a pin. A stream stopped by a failed attempt must be replaced for another attempt. This evidence does not replace the request cleanup completion barrier.

Summary

Functions

True only for a confirmed TCP or TLS setup failure before HTTP transmission.

Types

t()

@type t() :: %HTTP.RequestError{
  phase: :connect | :tls_setup | :unknown,
  reason: term(),
  request_started: false | :unknown
}

Functions

pre_send?(arg1)

@spec pre_send?(term()) :: boolean()

True only for a confirmed TCP or TLS setup failure before HTTP transmission.