MCPcopy Create free account
hub / github.com/Effect-TS/effect / fromHttpClientError

Method fromHttpClientError

packages/effect/src/ai/AiError.ts:183–193  ·  view source on GitHub ↗

* Creates a NetworkError from a platform HttpClientError whose reason is a * request error, keeping the HttpClientError as `cause`. * * **Example** (Creating a network error from an HTTP client error) * * ```ts import.meta.vitest * import { AiError } from "effect/ai" * import {

(
    error: HttpClientError.HttpClientError & { readonly reason: HttpClientError.RequestError }
  )

Source from the content-addressed store, hash-verified

181 * @since 4.1.0
182 */
183 static fromHttpClientError(
184 error: HttpClientError.HttpClientError & { readonly reason: HttpClientError.RequestError }
185 ): NetworkError {
186 return new NetworkError({
187 description: error.reason.description,
188 reason: error.reason._tag,
189 method: error.reason.request.method,
190 url: error.reason.request.url,
191 cause: error
192 })
193 }
194
195 override get message(): string {
196 const methodAndUrl = `${this.method} ${this.url}`

Callers 8

errors.tsFile · 0.45
errors.tsFile · 0.45
errors.tsFile · 0.45
errors.tsFile · 0.45
errors.tsFile · 0.45
errors.tsFile · 0.45
statusCodeErrorFunction · 0.45
httpClientErrorFunction · 0.45

Calls

no outgoing calls

Tested by 1

statusCodeErrorFunction · 0.36