HttpErrorUnion
PackageAxial.HttpClient
HttpError
HttpError is the single typed error of Axial.HttpClient. Every request that cannot produce its expected value
fails with one case of this union, so callers handle one error type instead of catching exceptions. Interrupting the
workflow is not a case here: an interrupted request ends with Cause.Interrupt, never an HttpError.
The union
| Case | Raised when |
|---|---|
InvalidRequest message |
The request could not be constructed, for example from a malformed URL. |
ConnectionFailed (request, message) |
The connection could not be established or was dropped before a response arrived. |
TimedOut (request, timeout) |
The per-request timeout elapsed before the response completed. |
Status response |
The response arrived with a status outside the request's expectation; the full transcript is carried. |
DecodeFailed (message, response) |
The response body could not be decoded into the requested value; the full transcript is carried. |
ResponseTooLarge (request, limit) |
The response body exceeded the request's maxResponseBytes limit, so it was not read. |
ConnectionFailed, TimedOut, and ResponseTooLarge carry a redacted request line; Status and DecodeFailed
carry the full HttpResponse transcript so an error handler can log the offending payload without re-fetching it.
Module helpers
HttpError.describe errorformats any case with its redacted request context and a bounded body preview, so a singleFlow.mapError HttpError.describeproduces loggable messages.HttpError.tryResponse errorextracts the transcript from the cases that carry one (StatusandDecodeFailed).HttpError.isTransient errorclassifies exactly the failures where a retry can help: connection failures, timeouts, and 408/429/5xx statuses.HttpError.transientRetry retries baseDelaybuilds aSchedulethat retries only transient errors, with exponential backoff frombaseDelaycapped at 65536 times it.retriescounts retries after the first attempt.
Read the responses and errors guide for a response walkthrough and reliability for timeouts and retries.
Specification
Kind
Union
Members
16
Examples
0
describeSignature
HttpError.describe error
tryResponseSignature
HttpError.tryResponse _arg1
isTransientSignature
HttpError.isTransient _arg1
transientRetrySignature
HttpError.transientRetry retries baseDelay
IsStatusSignature
this.IsStatus
Summary
| Name | Signature | Synopsis |
|---|---|---|
| Union cases | ||
| IsStatus | this.IsStatus | No description available. |
| IsInvalidRequest | this.IsInvalidRequest | No description available. |
| IsTimedOut | this.IsTimedOut | No description available. |
| IsDecodeFailed | this.IsDecodeFailed | No description available. |
| IsConnectionFailed | this.IsConnectionFailed | No description available. |
| IsResponseTooLarge | this.IsResponseTooLarge | No description available. |
| InvalidRequest | InvalidRequest message | The request could not be constructed, for example from a malformed URL. |
| ConnectionFailed | ConnectionFailed(request, message) | The connection could not be established or was dropped before a response arrived. |
| TimedOut | TimedOut(request, timeout) | The per-request timeout elapsed before the response completed. |
| Status | Status response | The response arrived with a status outside the request's expectation. |
| DecodeFailed | DecodeFailed(message, response) | The response body could not be decoded into the requested value. |
| ResponseTooLarge | ResponseTooLarge(request, limit) | The response body exceeded the request's <c>Request.maxResponseBytes</c> limit, so it was not read. |
| Operations | ||
| describe | HttpError.describe error | Formats an HTTP error with its redacted request context. |
| tryResponse | HttpError.tryResponse _arg1 | Returns the response transcript when the error carries one. |
| isTransient | HttpError.isTransient _arg1 | Indicates whether retrying the same request could plausibly succeed. |
| transientRetry | HttpError.transientRetry retries baseDelay | Builds a schedule that retries only transient HTTP errors, with exponential backoff from <paramref name="baseDelay" /> capped at 65536 times it. |
Union cases
kind:member
kind:member
kind:member
kind:member
kind:member
Operations
kind:member
kind:member
kind:member
Indicates whether retrying the same request could plausibly succeed.
Connection failures, timeouts, and 408/429/5xx statuses are transient.
<example><code>if HttpError.isTransient error then retry ()</code></example>
Parameters
| Name | Type | Description |
|---|---|---|
| _arg1 | HttpError |
Returns
bool
kind:member
Builds a schedule that retries only transient HTTP errors, with exponential backoff from
<paramref name="baseDelay" /> capped at 65536 times it. <paramref name="retries" /> counts retries after the
first attempt.
<example><code>workflow |> Flow.retry (HttpError.transientRetry 3 (TimeSpan.FromMilliseconds 200.0))</code></example>
Parameters
| Name | Type | Description |
|---|---|---|
| retries | int | |
| baseDelay | TimeSpan |
Returns
Schedule<'env, HttpError, int>

