Hyperlinkv0.8.0-beta.28

Channel

Channel.orDieconsteffect/Channel.ts:5599
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
): Channel<OutElem, never, OutDone, InElem, InErr, InDone, Env>

Converts all errors in the channel to defects (unrecoverable failures). This is useful when you want to treat errors as programming errors.

Example (Converting failures to defects)

import { Channel, Data } from "effect"

class ValidationError extends Data.TaggedError("ValidationError")<{
  readonly field: string
}> {}

// Create a channel that might fail
const failingChannel = Channel.fail(new ValidationError({ field: "email" }))

// Convert failures to defects
const fatalChannel = Channel.orDie(failingChannel)

// Any failure will now become a defect (uncaught exception)
error handling
Source effect/Channel.ts:559911 lines
export const orDie = <
  OutElem,
  OutErr,
  OutDone,
  InElem,
  InErr,
  InDone,
  Env
>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
): Channel<OutElem, never, OutDone, InElem, InErr, InDone, Env> => catch_(self, die)
Referenced by 1 symbols