lib/jsonresponse.js
function(err, results) {
  if(err) {
    this.success = false;
    this.error = err;
    this.results = null;

    // customize error for error types
    if(util.isError(err)) {
      this.error = {
        message: err.message,
        type: err.type,
        arguments: err.arguments
      };
      if(NODE_ENV === 'development') {
        this.error.stack = err.stack;
      }
    }    

  } else {
    this.success = true;
    this.error = null;      
    this.results = convertToClient(results);    
  }
}
function(err, results) {
  if(err) {
    this.success = false;
    this.error = err;
    this.results = null;

    // customize error for error types
    if(util.isError(err)) {
      this.error = {
        message: err.message,
        type: err.type,
        arguments: err.arguments
      };
      if(NODE_ENV === 'development') {
        this.error.stack = err.stack;
      }
    }    

  } else {
    this.success = true;
    this.error = null;      
    this.results = convertToClient(results);    
  }
}
function ( err , results ) { if ( err ) { this . success = false ; this . error = err ; this . results = null ; // customize error for error types if ( util . isError ( err ) ) { this . error = { message : err . message , type : err . type , arguments : err . arguments } ; if ( NODE_ENV === 'development' ) { this . error . stack = err . stack ; } } } else { this . success = true ; this . error = null ; this . results = convertToClient ( results ) ; } }
Creates a uniform Json response object
@param err the optional error
@param results the optional results
@constructor
Creates a uniform Json response object