chainTryCatchK<L, R, R2> function
TaskEither<L, R2> Function(TaskEither<L, R> taskEither)
chainTryCatchK<L, R, R2>(
- FutureOr<
R2> task(- R value
- L onError(
- dynamic err,
- StackTrace stackTrace
A chainable variant of tryCatchK.
expect(
await right('hello').chain(chainTryCatchK(
(s) => '$s world',
(err, stack) => 'fail',
))(),
E.right('hello world'),
);
expect(
await right('hello').chain(chainTryCatchK(
(s) => throw 'error',
(err, stack) => 'fail',
))(),
E.left('fail'),
);
Implementation
TaskEither<L, R2> Function(
TaskEither<L, R> taskEither,
) chainTryCatchK<L, R, R2>(
FutureOr<R2> Function(R value) task,
L Function(dynamic err, StackTrace stackTrace) onError,
) =>
flatMap(tryCatchK(task, onError));