MCPcopy Create free account
hub / github.com/effect-app/libs / toDatabaseError

Function toDatabaseError

packages/infra/src/Store/SQL.ts:26–27  ·  view source on GitHub ↗
(e: unknown)

Source from the content-addressed store, hash-verified

24// Map a SqlError into a typed, serializable DatabaseError (instead of `.orDie`,
25// which would turn it into an opaque, non-serializable defect).
26const toDatabaseError = (e: unknown) =>
27 new DatabaseError({ message: `SQL request failed: ${sqlErrorMessage(e)}`, transient: sqlIsTransient(e), cause: e })
28// withTransaction may re-raise setInternal's typed errors or add SqlError on begin/commit.
29// Preserve DatabaseError / OCC by `_tag` (not instanceof — dual package instances break it);
30// map residual SQL failures to DatabaseError.

Callers

nothing calls this directly

Calls 2

sqlErrorMessageFunction · 0.85
sqlIsTransientFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…