function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
    invokeGuardedCallback.apply(this, arguments);

    if (hasError) {
      var error = clearCaughtError();

      if (!hasRethrowError) {
        hasRethrowError = true;
        rethrowError = error;
      }
    }
  }
Same as invokeGuardedCallback, but instead of returning an error, it stores
it in a global so it can be rethrown by `rethrowCaughtError` later.
TODO: See if caughtError and rethrowError can be unified.

@param {String} name of the guard to use for logging or debugging
@param {Function} func The function to invoke
@param {*} context The context to use when calling the function
@param {...*} args Arguments for function