catchDefect<E2> method

ZIO<R, E2, A> catchDefect<E2>(
  1. ZIO<R, E2, A> f(
    1. Defect<E> _
    )
)

Catch any Defect's that may occur on this ZIO. The result will be replaced by executing the ZIO resulting from the given function.

Implementation

ZIO<R, E2, A> catchDefect<E2>(
  ZIO<R, E2, A> Function(Defect<E> _) f,
) =>
    _mapCauseFOr(
      (ctx, _) =>
          _ is Defect<E> ? f(_).unsafeRun(ctx) : Either.left(_.lift()),
    );