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

Function tryCosmos

packages/infra/src/Store/Cosmos.ts:51–60  ·  view source on GitHub ↗
(f: () => Promise<A>)

Source from the content-addressed store, hash-verified

49// `DatabaseError` (transient-classified) instead of a bare-`Error` defect — the
50// latter both bypasses retry and breaks JSON encoding of the failure channel.
51const tryCosmos = <A>(f: () => Promise<A>): Effect.Effect<A, DatabaseError> =>
52 Effect.tryPromise({
53 try: f,
54 catch: (e) =>
55 new DatabaseError({
56 message: `Cosmos request failed: ${e instanceof Error ? e.message : String(e)}`,
57 transient: thrownIsTransient(e),
58 cause: e
59 })
60 })
61
62const respBytes = (
63 resp: { diagnostics?: { clientSideRequestStatistics?: { totalResponsePayloadLengthInBytes?: number } } }

Callers 3

bulkSetInternalFunction · 0.85
batchSetFunction · 0.85
Cosmos.tsFile · 0.85

Calls 2

thrownIsTransientFunction · 0.85
StringInterface · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…