effect-io-ai

Package: effect
Module: Stream

Stream.fail

Terminates with the specified error.

Example

import { Effect, Stream } from "effect"

const stream = Stream.fail("Uh oh!")

Effect.runPromiseExit(Stream.runCollect(stream)).then(console.log)
// {
//   _id: 'Exit',
//   _tag: 'Failure',
//   cause: { _id: 'Cause', _tag: 'Fail', failure: 'Uh oh!' }
// }

Signature

declare const fail: <E>(error: E) => Stream<never, E>

Source

Since v2.0.0