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

Function causeSquash

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

Source from the content-addressed store, hash-verified

297
298/** @internal */
299export const causeSquash = <E>(self: Cause.Cause<E>): unknown => {
300 const partitioned = causePartition(self)
301 if (partitioned.Fail.length > 0) {
302 return partitioned.Fail[0].error
303 } else if (partitioned.Die.length > 0) {
304 return partitioned.Die[0].defect
305 } else if (partitioned.Interrupt.length > 0) {
306 return new globalThis.Error("All fibers interrupted without error")
307 }
308 return new globalThis.Error("Empty cause")
309}
310
311/** @internal */
312export const causePrettyErrors = <E>(self: Cause.Cause<E>, options?: {

Callers 1

effect.tsFile · 0.85

Calls 1

causePartitionFunction · 0.85

Tested by

no test coverage detected