The error of an HTTP client (Effect's HttpClientError).
Every client failure is one HttpClientError whose reason says what
went wrong. Request reasons (TransportError, EncodeError,
InvalidUrlError) carry the request; response reasons
(StatusCodeError, DecodeError, EmptyBodyError) the response too.
Match a reason with catch_reason::
client.get(url).pipe(
fx.catch_reason(HttpClientError, StatusCodeError, lambda reason, _e: fx.succeed(None))
)Messages name the method and the URL with its secrets redacted
(url_params.redact_url), and never the headers or the body. str()
of an error without a description adds its cause:
Transport error (POST http://.../jobs): ConnectError: ....
Types#
| Type | Definition | Description |
|---|---|---|
RequestError | type RequestError = TransportError | EncodeError | InvalidUrlError | |
ResponseError | type ResponseError = StatusCodeError | DecodeError | EmptyBodyError | |
HttpClientErrorReason | type HttpClientErrorReason = RequestError | ResponseError | |
HttpClientErrorKind | type HttpClientErrorKind = Literal['EncodeError', 'DecodeError', 'TransportError', 'InvalidUrlError', 'StatusCodeError', 'EmptyBodyError'] |