Example #1
0
winston.makeMissingParamError = function(paramName, extraInput, skipStacktraceLinesInput) {
  var skipStacktraceLines = 4;
  if ( skipStacktraceLinesInput !== undefined ) {
    skipStacktraceLines = skipStacktraceLinesInput;
  }
  var extra = winston.mergeExtra( extraInput, {});
  var error = winston.makeResponseError('missing param: ' + paramName, 500, 'internal error', extra, skipStacktraceLines);
  return error;
}
Example #2
0
winston.makeAzureError = function(azureErr, extraInput, skipStacktraceLinesInput) {
  var skipStacktraceLines = 4;
  if ( skipStacktraceLinesInput !== undefined ) {
    skipStacktraceLines = skipStacktraceLinesInput;
  }
  var extra = winston.mergeExtra( extraInput, {azureErr: azureErr});
  var error = winston.makeResponseError('azure error', 500, 'internal error', extra, skipStacktraceLines);
  return error;
}
Example #3
0
winston.makeRequestError = function(requestError, extraInput, skipStacktraceLinesInput) {
  var skipStacktraceLines = 4;
  if ( skipStacktraceLinesInput !== undefined ) {
    skipStacktraceLines = skipStacktraceLinesInput;
  }
  var extra = winston.mergeExtra( extraInput, {requestError: requestError.message});
  var error = winston.makeResponseError('request error', 500, 'internal error', extra, skipStacktraceLines);
  return error;
}
Example #4
0
winston.makeElasticSearchError = function(esErr, extraInput, skipStacktraceLinesInput) {
  var skipStacktraceLines = 4;
  if ( skipStacktraceLinesInput !== undefined ) {
    skipStacktraceLines = skipStacktraceLinesInput;
  }
  var esErrorString = '';
  if ( esErr ) {
    esErrorString = esErr.toString();
  }
  var extra = winston.mergeExtra( extraInput, {esErr: esErrorString});
  var error = winston.makeResponseError('elastic search error', 500, 'internal error', extra, skipStacktraceLines);
  return error;
}
Example #5
0
winston.makeS3Error = function(s3Err, extraInput, skipStacktraceLinesInput) {
  var skipStacktraceLines = 4;
  if ( skipStacktraceLinesInput !== undefined ) {
    skipStacktraceLines = skipStacktraceLinesInput;
  }
  var newExtra = {};
  if ( s3Err ) {
    newExtra['s3Err'] = s3Err.message;
  }
  var extra = winston.mergeExtra( extraInput, newExtra );
  var error = winston.makeResponseError('s3 error', 500, 'internal error', extra, skipStacktraceLines);
  return error;
}
Example #6
0
winston.makeMongoError = function(mongoErrInput, extraInput, skipStacktraceLinesInput) {
  var skipStacktraceLines = 4;
  if ( skipStacktraceLinesInput !== undefined ) {
    skipStacktraceLines = skipStacktraceLinesInput;
  }
  var mongoErr = mongoErrInput;
  if ( mongoErrInput && ( typeof mongoErrInput == 'object' ) ) {
    mongoErr = mongoErrInput.toString();
  }
  var extra = winston.mergeExtra( extraInput, {mongoErr: mongoErr});
  var error = winston.makeResponseError('mongo error', 500, 'internal error', extra, skipStacktraceLines);
  return error;
}
Example #7
0
winston.doResponseError = function(res, log, responseCode, userMessage, extraInput) {
  winston.handleError( winston.makeResponseError(log, responseCode, userMessage, extraInput, 4), res );
}