ZIO<R, E, A>.tryCatchEnv constructor
ZIO<R, E, A>.tryCatchEnv (
- FutureOr<
A> f(- R env
- E onError(
- dynamic error,
- StackTrace stackTrace
A variant of ZIO.tryCatch that provides the current environment R
to the
function f
.
Implementation
factory ZIO.tryCatchEnv(
FutureOr<A> Function(R env) f,
E Function(dynamic error, StackTrace stackTrace) onError,
) =>
ZIO.from(
(ctx) => fromThrowable(
() => f(ctx.env),
onError: (e, s) => Failure(onError(e, s)),
),
);