fromThrowable<T, E> static method
TODO: Need to figure out how to wrap the function instead
Implementation
static Result<T, E> fromThrowable<T, E>(T Function() fn,
{E Function(Object?)? errorFn}) {
try {
return ok(fn());
} catch (e) {
return err(errorFn != null ? errorFn(e) : e as E);
}
}