tryCatch<L, R, Err extends Object> static method
Constructs a new Either from a function that might throw
Implementation
static Either<L, R> tryCatch<L, R, Err extends Object>(
L Function(Err err) onError, R Function() fnR) {
try {
return Right(fnR());
} on Err catch (e) {
return Left(onError(e));
}
}