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

Function queryFailureReason

packages/sql/pg/test/SqlErrorClassification.test.ts:7–17  ·  view source on GitHub ↗
(cause: unknown)

Source from the content-addressed store, hash-verified

5import type * as SqlError from "effect/unstable/sql/SqlError"
6
7const queryFailureReason = (cause: unknown) =>
8 Effect.gen(function*() {
9 const client = yield* PgClient.fromPool({
10 acquire: Effect.succeed(makeFailingPool(cause) as any)
11 })
12 const error = yield* Effect.flip(client`SELECT 1`)
13 return error.reason
14 }).pipe(
15 Effect.scoped,
16 Effect.provide(Reactivity.layer)
17 )
18
19const queryFailureReasonTag = (cause: unknown) => Effect.map(queryFailureReason(cause), (reason) => reason._tag)
20

Callers 2

queryFailureReasonTagFunction · 0.70

Calls 6

clientFunction · 0.85
makeFailingPoolFunction · 0.70
pipeMethod · 0.65
succeedMethod · 0.45
flipMethod · 0.45
provideMethod · 0.45

Tested by

no test coverage detected