tryCatch<C, L, R> function

ReaderTaskEither<C, L, R> tryCatch<C, L, R>(
  1. FutureOr<R> task(),
  2. L onError(
    1. dynamic err,
    2. StackTrace stackTrace
    )
)

Runs the given task, and returns the result as an Right. If it throws an error, the the error is passed to onError, which determines the Left value.

Implementation

ReaderTaskEither<C, L, R> tryCatch<C, L, R>(
  FutureOr<R> Function() task,
  L Function(dynamic err, StackTrace stackTrace) onError,
) =>
    ReaderTaskEither((r) => TE.tryCatch(task, onError));