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

Function assertSqlFailure

packages/sql/pg/test/Client.integration.test.ts:659–664  ·  view source on GitHub ↗
(cause: Cause.Cause<unknown>)

Source from the content-addressed store, hash-verified

657 const sql = yield* PgClient.makeClient((yield* PgClient.PgClient).config)
658 const select = sql<{ value: number }>`SELECT ${1}::int4 AS value`
659 const assertSqlFailure = (cause: Cause.Cause<unknown>) => {
660 assert.isFalse(Cause.hasDies(cause))
661 const error = Cause.squash(cause)
662 assert.instanceOf(error, SqlError.SqlError)
663 assert.propertyVal(error.reason.cause, "code", "26000")
664 }
665 // Prepares BEGIN, the body, ROLLBACK and COMMIT.
666 yield* sql.withTransaction(Effect.andThen(select, Effect.fail("rollback"))).pipe(Effect.flip)
667 yield* sql.withTransaction(select)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected