function error(name, returnVal, throwReturnVal) {
    var returnValDefined = (arguments.length >= 2);
    name = 'error' + (name || '');
    return function() {
      if (!returnValDefined) {
        _logInvocation(name, arguments, 'reject(' + _argToString(arguments[0]) + ')', throwReturnVal);
        return q.reject(arguments[0]);
      } else {
        return _logInvocation(name, arguments, returnVal, throwReturnVal);
      }
    };
  }
Creates a callback that logs its invocation in `log`.

@param {(number|string)} name Suffix for 'error' name. e.g. error(1) => error
@param {*=} returnVal Value that the callback should return. If unspecified, the passed in
    value is first passed to q.reject() and the result is returned.
@param {boolean=} throwReturnVal If true, the `returnVal` will be thrown rather than returned.