Package: effect
Module: Stream
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)
Signature
declare const fail: <E>(error: E) => Stream<never, E>
Since v2.0.0