MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / noneWhenGone

Function noneWhenGone

apps/cloud/scripts/drain-workos-events.ts:65–71  ·  view source on GitHub ↗
(fn: () => Promise<A>)

Source from the content-addressed store, hash-verified

63 (cause as { readonly status: unknown }).status === 404;
64
65const noneWhenGone = <A>(fn: () => Promise<A>) =>
66 Effect.tryPromise({ try: fn, catch: (cause) => cause }).pipe(
67 Effect.map(Option.some),
68 Effect.catch((cause) =>
69 isNotFound(cause) ? Effect.succeed(Option.none<A>()) : Effect.fail(cause),
70 ),
71 );
72
73// One pass is bounded by the replay's page budget; loop until the stream
74// is drained, another run owns it, or the backfill has not run.

Callers 1

Calls 1

isNotFoundFunction · 0.85

Tested by

no test coverage detected