Hyperlinkv0.8.0-beta.28

ErrorReporter

ErrorReporter.reportconsteffect/ErrorReporter.ts:272
<E>(cause: Cause.Cause<E>): Effect.Effect<void>

Runs all registered error reporters on the current fiber for a Cause.

When to use

Use to report a failure for observability without failing the current fiber.

Example (Reporting a cause manually)

import { Cause, Effect, ErrorReporter } from "effect"

// Log the cause for monitoring, then continue with a fallback
const program = Effect.gen(function*() {
  const cause = Cause.fail("something went wrong")
  yield* ErrorReporter.report(cause)
  return "fallback value"
})
Reporting
export const report = <E>(cause: Cause.Cause<E>): Effect.Effect<void> =>
  Effect.withFiber((fiber) => {
    effect.reportCauseUnsafe(fiber, cause)
    return Effect.void
  })