import { Cause, Effect, pipe } from "effect"
const program1 =
pipe(
Effect.try(() => { throw new Error("Some error :/") })
)
const main =
await pipe(
Effect.Do,
Effect.bind("sub", () => program1),
Effect.tap(() =>
Effect.logInfo("another message from main"),
),
Effect.catchAll(error =>
Effect.logInfo("cause", error)
),
Effect.runPromise
)
import { Cause, Effect, pipe } from "effect"
const program1 =
pipe(
Effect.try(() => { throw new Error("Some error :/") })
)
const main =
await pipe(
Effect.Do,
Effect.bind("sub", () => program1),
Effect.tap(() =>
Effect.logInfo("another message from main"),
),
Effect.catchAll(error =>
Effect.logInfo("cause", error)
),
Effect.runPromise
)