Hyperlinkv0.8.0-beta.28

Cause

Cause.prettyconsteffect/Cause.ts:1159
<E>(cause: Cause<E>): string

Formats a Cause as a human-readable string for logging or debugging.

When to use

Use to render a whole cause as one human-readable string for logs or diagnostics.

Details

Delegates to prettyErrors to convert each reason to an Error, then joins their stack traces with newlines. Nested Error.cause chains are rendered inline with indentation:

ErrorName: message
    at ...
    at ... {
  [cause]: NestedError: message
      at ...
}

Span annotations are appended to the relevant stack frames when available.

Gotchas

Rendering an empty cause produces an empty string because there are no errors to render.

Example (Rendering a cause)

import { Cause } from "effect"

const rendered = Cause.pretty(Cause.fail("something went wrong"))
console.log(rendered.includes("something went wrong")) // true
renderingprettyErrors
Source effect/Cause.ts:11591 lines
export const pretty: <E>(cause: Cause<E>) => string = effect.causePretty
Referenced by 1 symbols