Try to run a function and return the result. If the function throws, return the result of the catch
function.
method
$.ShellPromise.try
fn: (...args: A) => T | PromiseLike<T>,
...args: A
): Promise<T>;
@param fn
The function to run
@param args
The arguments to pass to the function. This is similar to setTimeout
and avoids the extra closure.
@returns
The result of the function or the result of the catch
function