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

Function runPromise

packages/effect/src/Micro.ts:4266–4278  ·  view source on GitHub ↗
(
  effect: Micro<A, E>,
  options?: {
    readonly signal?: AbortSignal | undefined
    readonly scheduler?: MicroScheduler | undefined
  } | undefined
)

Source from the content-addressed store, hash-verified

4264 * @category execution
4265 */
4266export const runPromise = <A, E>(
4267 effect: Micro<A, E>,
4268 options?: {
4269 readonly signal?: AbortSignal | undefined
4270 readonly scheduler?: MicroScheduler | undefined
4271 } | undefined
4272): Promise<A> =>
4273 runPromiseExit(effect, options).then((exit) => {
4274 if (exit._tag === "Failure") {
4275 throw exit.cause
4276 }
4277 return exit.value
4278 })
4279
4280/**
4281 * Attempt to execute the `Micro` effect synchronously and return the `MicroExit`.

Callers

nothing calls this directly

Calls 1

runPromiseExitFunction · 0.70

Tested by

no test coverage detected