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

Function causeElectDefects

packages/effect/src/internal/effect.ts:203–210  ·  view source on GitHub ↗
(self: Cause.Cause<E>)

Source from the content-addressed store, hash-verified

201 * @internal
202 */
203export const causeElectDefects = <E>(self: Cause.Cause<E>): Cause.Cause<E> =>
204 hasDies(self) && hasFails(self)
205 ? causeFromReasons(
206 self.reasons.map((reason) =>
207 reason._tag === "Fail" && !isDone(reason.error) ? new Die(reason.error, reason.annotations) : reason
208 )
209 )
210 : self
211
212/**
213 * Selects the first typed error unless a defect is present, in which case

Callers 3

findRecoverableErrorFunction · 0.85
onExitFunction · 0.85
effect.tsFile · 0.85

Calls 5

causeFromReasonsFunction · 0.90
isDoneFunction · 0.90
hasDiesFunction · 0.85
hasFailsFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected