GitHub

API reference for error.

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

TypeDefinitionDescription
RequestErrortype RequestError = TransportError | EncodeError | InvalidUrlError
ResponseErrortype ResponseError = StatusCodeError | DecodeError | EmptyBodyError
HttpClientErrorReasontype HttpClientErrorReason = RequestError | ResponseError
HttpClientErrorKindtype HttpClientErrorKind = Literal['EncodeError', 'DecodeError', 'TransportError', 'InvalidUrlError', 'StatusCodeError', 'EmptyBodyError']

Classes