Hyperlinkv0.8.0-beta.28

Channel

Channel.tapErrorconsteffect/Channel.ts:4428
<OutErr, A, E, R>(f: (d: OutErr) => Effect.Effect<A, E, R>): <
  OutElem,
  OutDone,
  InElem,
  InErr,
  InDone,
  Env
>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
) => Channel<
  OutElem,
  OutErr | E,
  OutDone | void,
  InElem,
  InErr,
  InDone,
  Env | R
>
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, A, E, R>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  f: (d: OutErr) => Effect.Effect<A, E, R>
): Channel<
  OutElem,
  OutErr | E,
  OutDone | void,
  InElem,
  InErr,
  InDone,
  Env | R
>

Runs an effect when the channel fails with a typed error, then preserves the original channel failure.

Details

The effect is not run for normal channel completion. If the observer effect fails, that failure can fail the returned channel.

error handling
Source effect/Channel.ts:442873 lines
export const tapError: {
  <OutErr, A, E, R>(
    f: (d: OutErr) => Effect.Effect<A, E, R>
  ): <
    OutElem,
    OutDone,
    InElem,
    InErr,
    InDone,
    Env
  >(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>) => Channel<
    OutElem,
    OutErr | E,
    OutDone | void,
    InElem,
    InErr,
    InDone,
    Env | R
  >
  <
    OutElem,
    OutErr,
    OutDone,
    InElem,
    InErr,
    InDone,
    Env,
    A,
    E,
    R
  >(
    self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
    f: (d: OutErr) => Effect.Effect<A, E, R>
  ): Channel<
    OutElem,
    OutErr | E,
    OutDone | void,
    InElem,
    InErr,
    InDone,
    Env | R
  >
} = dual(2, <
  OutElem,
  OutErr,
  OutDone,
  InElem,
  InErr,
  InDone,
  Env,
  A,
  E,
  R
>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  f: (d: OutErr) => Effect.Effect<A, E, R>
): Channel<
  OutElem,
  OutErr | E,
  OutDone | void,
  InElem,
  InErr,
  InDone,
  Env | R
> =>
  transformPull(
    self,
    (pull) =>
      Effect.succeed(Effect.tapError(
        pull,
        (err) => Cause.isDone(err) ? Effect.void : Effect.asVoid(f(err))
      ))
  ))
Referenced by 1 symbols