Hyperlinkv0.8.0-beta.28

Stream

Stream.failconsteffect/Stream.ts:926
<E>(error: E): Stream<never, E>

Terminates with the specified error.

Example (Failing a stream)

import { Console, Effect, Stream } from "effect"

const program = Effect.gen(function*() {
  const stream = Stream.fail("Uh oh!")
  const exit = yield* Effect.exit(Stream.runCollect(stream))
  yield* Console.log(exit)
  // Output: { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Uh oh!' } }
})

Effect.runPromise(program)
constructors
Source effect/Stream.ts:9261 lines
export const fail = <E>(error: E): Stream<never, E> => fromChannel(Channel.fail(error))
Referenced by 2 symbols