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

Function try_

packages/effect/src/Micro.ts:1021–1031  ·  view source on GitHub ↗
(options: {
  try: LazyArg<A>
  catch: (error: unknown) => E
})

Source from the content-addressed store, hash-verified

1019}
1020
1021const try_ = <A, E>(options: {
1022 try: LazyArg<A>
1023 catch: (error: unknown) => E
1024}): Micro<A, E> =>
1025 suspend(() => {
1026 try {
1027 return succeed(options.try())
1028 } catch (err) {
1029 return fail(options.catch(err))
1030 }
1031 })
1032export {
1033 /**
1034 * The `Micro` equivalent of a try / catch block, which allows you to map

Callers

nothing calls this directly

Calls 3

suspendFunction · 0.70
failFunction · 0.70
succeedFunction · 0.50

Tested by

no test coverage detected