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

Function statusCodeError

packages/effect/test/ui/UiRpc.test.ts:35–43  ·  view source on GitHub ↗
(status: number)

Source from the content-addressed store, hash-verified

33const clientError = (reason: RpcClientError.RpcClientError["reason"]) => new RpcClientError.RpcClientError({ reason })
34const request = HttpClientRequest.get("http://todos.internal:8080/rpc")
35const statusCodeError = (status: number) =>
36 clientError(HttpClientError.HttpClientErrorSchema.fromHttpClientError(
37 new HttpClientError.HttpClientError({
38 reason: new HttpClientError.StatusCodeError({
39 request,
40 response: HttpClientResponse.fromWeb(request, new Response("upstream stack: s3cret", { status }))
41 })
42 })
43 ))
44const failures: Record<number, RpcClientError.RpcClientError> = {
45 3: statusCodeError(502),
46 4: clientError(new Socket.SocketCloseError({ code: 1011, closeReason: "s3cret" })),

Callers 1

UiRpc.test.tsFile · 0.70

Calls 2

clientErrorFunction · 0.85
fromHttpClientErrorMethod · 0.45

Tested by

no test coverage detected