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

Function catchNoSuchElement

packages/effect/src/internal/effect.ts:2574–2583  ·  view source on GitHub ↗
(
  self: Effect.Effect<A, E, R>
)

Source from the content-addressed store, hash-verified

2572
2573/** @internal */
2574export const catchNoSuchElement = <A, E, R>(
2575 self: Effect.Effect<A, E, R>
2576): Effect.Effect<Option.Option<A>, Exclude<E, Cause.NoSuchElementError>, R> =>
2577 matchEffect(self, {
2578 onFailure: (error) =>
2579 isNoSuchElementError(error)
2580 ? succeedNone
2581 : fail(error as Exclude<E, Cause.NoSuchElementError>),
2582 onSuccess: succeedSome
2583 })
2584
2585/** @internal */
2586export const catchDefect: {

Callers

nothing calls this directly

Calls 2

isNoSuchElementErrorFunction · 0.90
failFunction · 0.70

Tested by

no test coverage detected