Package: effect
Module: Cause
Extracts the most “important” defect from a Cause.
Details
This function reduces a Cause to a single, prioritized defect. It evaluates
the Cause in the following order of priority:
Cause contains a failure (e.g., from Effect.fail), it returns
the raw error value.Effect.die).Cause stems from an
interruption, it creates and returns an InterruptedException.This function ensures you can always extract a meaningful representation of
the primary issue from a potentially complex Cause structure.
When to Use
Use this function when you need to extract the most relevant error or defect
from a Cause, especially in scenarios where multiple errors or defects may
be present. It’s particularly useful for simplifying error reporting or
logging.
See
squashWith Allows transforming failures into defects when squashing.Signature
declare const squash: <E>(self: Cause<E>) => unknown
Since v2.0.0