tryCatchK<L, R, T> static method
- R run(
- T
- L onError(
- Object o,
- StackTrace s
Try to execute run
. If no error occurs, then return Right.
Otherwise return Left containing the result of onError
.
run
has one argument, which allows for easier chaining with
Either.flatMap
.
Implementation
static Either<L, R> Function(T) tryCatchK<L, R, T>(
R Function(T) run, L Function(Object o, StackTrace s) onError) =>
(a) => Either.tryCatch(
() => run(a),
onError,
);