lib/util/common.js
function handleError(err, msg, code, req, res){
  logError(err, msg, code, req);

  var response = buildErrorObject({
    err: err,
    msg: msg,
    httpCode: code
  });

  res.statusCode = response.httpCode;
  res.end(JSON.stringify(response.errorFields));
}
function handleError(err, msg, code, req, res){
  logError(err, msg, code, req);

  var response = buildErrorObject({
    err: err,
    msg: msg,
    httpCode: code
  });

  res.statusCode = response.httpCode;
  res.end(JSON.stringify(response.errorFields));
}
function handleError ( err , msg , code , req , res ) { logError ( err , msg , code , req ) ; var response = buildErrorObject ( { err : err , msg : msg , httpCode : code } ) ; res . statusCode = response . httpCode ; res . end ( JSON . stringify ( response . errorFields ) ) ; }
generic error handler
generic error handler