Skip to content

HttpClientError.ts

Typed failure model for Effect HTTP client operations.

HTTP clients wrap request construction, transport, status-code validation, and response decoding failures in HttpClientError. The wrapper keeps the failed request and the specific failure reason together, so callers can handle client failures uniformly while still matching on the reason _tag for retry policy, logging, metrics, and user-facing messages.

Since v4.0.0



Response error for failures while decoding an HTTP response body.

Signature

declare class DecodeError

Source

Since v4.0.0

Response error for operations that expected a response body but received an empty body.

Signature

declare class EmptyBodyError

Source

Since v4.0.0

Error describing failures while encoding an HTTP request body.

Signature

declare class EncodeError

Source

Since v4.0.0

Error wrapper for HTTP client failures, exposing the failed request and the optional response through its reason.

Signature

declare class HttpClientError {
constructor(props: { readonly reason: HttpClientErrorReason })
}

Source

Since v4.0.0

Marks this value as an HTTP client error for runtime guards.

Signature

readonly [TypeId]: "~effect/http/HttpClientError"

Source

Since v4.0.0

Union of all specific failure reasons carried by HttpClientError.

Signature

type HttpClientErrorReason = RequestError | ResponseError

Source

Since v4.0.0

Error describing failures while constructing a URL from an HTTP client request.

Signature

declare class InvalidUrlError

Source

Since v4.0.0

Union of HTTP client errors that occur before a response is available.

Signature

type RequestError = TransportError | EncodeError | InvalidUrlError

Source

Since v4.0.0

Union of HTTP client errors that include an HTTP response.

Signature

type ResponseError = StatusCodeError | DecodeError | EmptyBodyError

Source

Since v4.0.0

Response error for HTTP responses rejected because of their status code.

Signature

declare class StatusCodeError

Source

Since v4.0.0

Error describing transport-level failures that occur while sending an HTTP request.

Signature

declare class TransportError

Source

Since v4.0.0

Returns true when a value is an HttpClientError.

Signature

declare const isHttpClientError: (u: unknown) => u is HttpClientError

Source

Since v4.0.0

Schema for serializable HTTP client errors, preserving the specific error kind and cause.

Signature

declare class HttpClientErrorSchema

Source

Since v4.0.0

Builds the serializable schema representation for an HTTP client error.

Signature

declare const fromHttpClientError: (error: HttpClientError) => HttpClientErrorSchema

Source

Since v4.0.0