executeProtectedResult<S> function

Result<S, Object> executeProtectedResult<S>(
  1. Result<S, Object> func()
)

Result unwrapping version of executeProtected. Where func returns an Result, but can still throw.

Implementation

Result<S,Object> executeProtectedResult<S>(Result<S,Object> Function() func) {
  try {
    return func();
  } catch (e) {
    return Err(e);
  }
}