lib/interfaces/manual.js
function reportManualError(err, request, additionalMessage, callback) {
    if (isString(request)) {
      // no request given
      callback = additionalMessage;
      additionalMessage = request;
      request = undefined;
    } else if (isFunction(request)) {
      // neither request nor additionalMessage given
      callback = request;
      request = undefined;
      additionalMessage = undefined;
    }

    if (isFunction(additionalMessage)) {
      callback = additionalMessage;
      additionalMessage = undefined;
    }

    var em = new ErrorMessage();
    em.setServiceContext(config.getServiceContext().service,
                         config.getServiceContext().version);

    errorHandlerRouter(err, em);

    if (isObject(request)) {
      em.consumeRequestInformation(manualRequestInformationExtractor(request));
    }

    if (isString(additionalMessage)) {
      em.setMessage(additionalMessage);
    }

    client.sendError(em, callback);
    return em;
  }
function reportManualError(err, request, additionalMessage, callback) {
    if (isString(request)) {
      // no request given
      callback = additionalMessage;
      additionalMessage = request;
      request = undefined;
    } else if (isFunction(request)) {
      // neither request nor additionalMessage given
      callback = request;
      request = undefined;
      additionalMessage = undefined;
    }

    if (isFunction(additionalMessage)) {
      callback = additionalMessage;
      additionalMessage = undefined;
    }

    var em = new ErrorMessage();
    em.setServiceContext(config.getServiceContext().service,
                         config.getServiceContext().version);

    errorHandlerRouter(err, em);

    if (isObject(request)) {
      em.consumeRequestInformation(manualRequestInformationExtractor(request));
    }

    if (isString(additionalMessage)) {
      em.setMessage(additionalMessage);
    }

    client.sendError(em, callback);
    return em;
  }
function reportManualError ( err , request , additionalMessage , callback ) { if ( isString ( request ) ) { // no request given callback = additionalMessage ; additionalMessage = request ; request = undefined ; } else if ( isFunction ( request ) ) { // neither request nor additionalMessage given callback = request ; request = undefined ; additionalMessage = undefined ; } if ( isFunction ( additionalMessage ) ) { callback = additionalMessage ; additionalMessage = undefined ; } var em = new ErrorMessage ( ) ; em . setServiceContext ( config . getServiceContext ( ) . service , config . getServiceContext ( ) . version ) ; errorHandlerRouter ( err , em ) ; if ( isObject ( request ) ) { em . consumeRequestInformation ( manualRequestInformationExtractor ( request ) ) ; } if ( isString ( additionalMessage ) ) { em . setMessage ( additionalMessage ) ; } client . sendError ( em , callback ) ; return em ; }
The interface for manually reporting errors to the Google Error API in
application code.
@param {Any} err - error information of any type or content. This can be
of any type but better errors will be logged given a valid instance of
Error class.
@param {Object} [request] - an object containing request information. This
is expected to be an object similar to the Node/Express request object.
@param {String} [additionalMessage] - a string containing error message
information to override the builtin message given by an Error/Exception
@param {Function} [callback] - a callback to be invoked once the message
has been successfully submitted to the error reporting API or has failed
after four attempts with the success or error response.
@returns {ErrorMessage} - returns the error message created through with
the parameters given.
The interface for manually reporting errors to the Google Error API in application code .