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

Method fromRequestError

packages/effect/src/unstable/ai/AiError.ts:123–135  ·  view source on GitHub ↗

* Creates a NetworkError from a platform HttpClientError.RequestError. * * **Example** (Creating a network error from a request error) * * ```ts import.meta.vitest * import { AiError } from "effect/unstable/ai" * import { HttpClientError, HttpClientRequest } from "effect/unstable/h

(error: HttpClientError.RequestError)

Source from the content-addressed store, hash-verified

121 * @since 4.0.0
122 */
123 static fromRequestError(error: HttpClientError.RequestError): NetworkError {
124 return new NetworkError({
125 description: error.description,
126 reason: error._tag,
127 request: {
128 hash: Option.getOrUndefined(error.request.hash),
129 headers: redactHeaders(error.request.headers),
130 method: error.request.method,
131 url: error.request.url,
132 urlParams: Array.from(error.request.urlParams)
133 }
134 })
135 }
136
137 override get message(): string {
138 const methodAndUrl = `${this.request.method} ${this.request.url}`

Callers

nothing calls this directly

Calls 1

redactHeadersFunction · 0.85

Tested by

no test coverage detected