lib/classes/error-message.js
function ErrorMessage() {

  this.eventTime = (new Date()).toISOString();
  this.serviceContext = {service : 'node', version : undefined};
  this.message = '';
  this.context = {
    httpRequest : {
      method : '',
      url : '',
      userAgent : '',
      referrer : '',
      responseStatusCode : 0,
      remoteIp : ''
    },
    user : '',
    reportLocation : {filePath : '', lineNumber : 0, functionName : ''}
  };
}
function ErrorMessage() {

  this.eventTime = (new Date()).toISOString();
  this.serviceContext = {service : 'node', version : undefined};
  this.message = '';
  this.context = {
    httpRequest : {
      method : '',
      url : '',
      userAgent : '',
      referrer : '',
      responseStatusCode : 0,
      remoteIp : ''
    },
    user : '',
    reportLocation : {filePath : '', lineNumber : 0, functionName : ''}
  };
}
function ErrorMessage ( ) { this . eventTime = ( new Date ( ) ) . toISOString ( ) ; this . serviceContext = { service : 'node' , version : undefined } ; this . message = '' ; this . context = { httpRequest : { method : '' , url : '' , userAgent : '' , referrer : '' , responseStatusCode : 0 , remoteIp : '' } , user : '' , reportLocation : { filePath : '' , lineNumber : 0 , functionName : '' } } ; }
The constructor for ErrorMessage takes no arguments and is solely meant to
to instantiate properties on the instance. Each property should be externally
set using the corresponding set function with the exception of eventTime
which can be set externally but does not need to be since it is inited to
an ISO-8601 compliant time string.
@type {Object}
@class ErrorMessage
@classdesc ErrorMessage is a class which is meant to store and control-for
Stackdriver Error API submittable values. Meant to be JSON string-ifiable
representation of the final values which will be submitted to the Error API
this class enforces type-checking on every setter function and will write
default type-friendly values to instance properties if given values which
are type-incompatible to expectations. These type-friendly default
substitutions will occur silently and no errors will be thrown on attempted
invalid input under the premise that during misassignment some error
information sent to the Error API is better than no error information
due to the Error library failing under invalid input.
@property {String} eventTime - an ISO-8601 compliant string representing when
the error was created
@property {Object} serviceContext - The service information for the error
@property {String} serviceContext.service - The service that the error was
was produced on
@property {String|Undefined} serviceContext.version - The service version
that the error was produced on
@property {String} message - The error message
@property {Object} context - the request, user and report context
@property {Object} context.httpRequest - the request context
@property {String} context.httpRequest.method - the request method (e.g. GET)
@property {String} context.httpRequest.url - the request url or path
@property {String} context.httpRequest.userAgent - the requesting user-agent
@property {String} context.httpRequest.referrer - the request referrer
@property {Number} context.httpRequest.responseStatusCode - the request
status-code
@property {String} context.httpRequest.remoteIp - the requesting remote ip
@property {String} context.user - the vm instances user
@property {Object} context.reportLocation - the report context
@property {String} context.reportLocation.filePath - the file path of the
report site
@property {Number} context.reportLocation.lineNumber - the line number of the
report site
@property {String} context.reportLocation.functionName - the function name of
the report site
The constructor for ErrorMessage takes no arguments and is solely meant to to instantiate properties on the instance . Each property should be externally set using the corresponding set function with the exception of eventTime which can be set externally but does not need to be since it is inited to an ISO - 8601 compliant time string .