MCPcopy
hub / github.com/Effect-TS/effect / try_

Function try_

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

Source from the content-addressed store, hash-verified

1018}
1019
1020const try_ = <A, E>(options: {
1021 try: LazyArg<A>
1022 catch: (error: unknown) => E
1023}): Micro<A, E> =>
1024 suspend(() => {
1025 try {
1026 return succeed(options.try())
1027 } catch (err) {
1028 return fail(options.catch(err))
1029 }
1030 })
1031export {
1032 /**
1033 * 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