Package: effect
Module: Cause
Extracts the most “important” defect from a Cause, transforming failures
into defects using a provided function.
Details
This function reduces a Cause to a single, prioritized defect, while
allowing you to transform recoverable failures into defects through a custom
function. It processes the Cause in the following order:
Cause contains a failure (e.g., from Effect.fail), it applies
the provided function f to the error to transform it into a defect.Effect.die) and returns it.Cause stems from an interruption, it
returns an InterruptedException.This function is particularly useful when you need custom handling or
transformation of errors while processing a Cause.
See
squash Extracts the most “important” defect without transforming failures.Signature
declare const squashWith: { <E>(f: (error: E) => unknown): (self: Cause<E>) => unknown; <E>(self: Cause<E>, f: (error: E) => unknown): unknown; }
Since v2.0.0