Hyperlinkv0.8.0-beta.28

Effect

Effect.ignoreCauseconsteffect/Effect.ts:4249
<
  Arg extends
    | Effect<any, any, any>
    | {
        readonly log?: boolean | Severity | undefined
        readonly message?: string | undefined
      }
    | undefined = {
    readonly log?: boolean | Severity | undefined
    readonly message?: string | undefined
  }
>(
  effectOrOptions?: Arg,
  options?:
    | {
        readonly log?: boolean | Severity | undefined
        readonly message?: string | undefined
      }
    | undefined
): [Arg] extends [Effect<infer _A, infer _E, infer _R>]
  ? Effect<void, never, _R>
  : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>

Ignores the effect's failure cause, including defects and interruptions.

When to use

Use when a best-effort effect should never fail, even from defects or interruption, and optional cause logging is enough.

Details

Use the log option to emit the full Cause when the effect fails, and message to prepend a custom log message.

Example (Ignoring failures and logging causes)

import { Effect } from "effect"

const task = Effect.fail("boom")

const program = task.pipe(Effect.ignoreCause)
const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
error handlingCause
Source effect/Effect.ts:424916 lines
export const ignoreCause: <
  Arg extends Effect<any, any, any> | {
    readonly log?: boolean | Severity | undefined
    readonly message?: string | undefined
  } | undefined = {
    readonly log?: boolean | Severity | undefined
    readonly message?: string | undefined
  }
>(
  effectOrOptions?: Arg,
  options?: {
    readonly log?: boolean | Severity | undefined
    readonly message?: string | undefined
  } | undefined
) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R>
  : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R> = internal.ignoreCause
Referenced by 1 symbols